Files
gentoo-overlay/net-misc/pushpin/files/pushpin.initd
2024-02-24 01:48:19 +01:00

41 lines
1.3 KiB
Plaintext

#!/sbin/openrc-run
# Copyright 1999-2019 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
PUSHPIN_USER="${PUSHPIN_USER:-pushpin}"
PUSHPIN_GROUP="${PUSHPIN_GROUP:-pushpin}"
PUSHPIN_CONFIG="${PUSHPIN_CONFIG:-/etc/pushpin/pushpin.conf}"
PUSHPIN_DATA_DIR="${PUSHPIN_DATA_DIR:-/var/lib/pushpin}"
PUSHPIN_LOG_DIR="${PUSHPIN_LOG_DIR:-/var/log/pushpin}"
PUSHPIN_RUN_DIR="${PUSHPIN_RUN_DIR:-/var/run/pushpin}"
command="/usr/bin/pushpin"
command_args="--config ${PUSHPIN_CONFIG} --logfile \"${PUSHPIN_LOG_DIR}/pushpin.log\""
extra_started_commands="reload"
description_reload="Reload the pushpin configuration"
pidfile="/run/${RC_SVCNAME}.pid"
command_background="true"
start_stop_daemon_args="--user=\"${PUSHPIN_USER}\" --group=\"${PUSHPIN_GROUP}\""
configtest() {
ebegin "Checking configuration file"
test -f "${PUSHPIN_CONFIG}"
eend $? "Please check configuration for errors"
}
start_pre() {
checkpath -d -o "${PUSHPIN_USER}:${PUSHPIN_GROUP}" -m750 "${PUSHPIN_DATA_DIR}"
checkpath -d -o "${PUSHPIN_USER}:${PUSHPIN_GROUP}" -m750 "${PUSHPIN_LOG_DIR}"
checkpath -d -o "${PUSHPIN_USER}:${PUSHPIN_GROUP}" -m750 "${PUSHPIN_RUN_DIR}"
configtest || return 1
}
reload() {
configtest || return 1
ebegin "Refreshing pushpin configuration"
start-stop-daemon --signal SIGHUP --pidfile "${pidfile}"
eend $? "Failed to reload pushpin"
}