1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
|
#!/bin/sh
# kFreeBSD do not accept scripts as interpreters, using #!/bin/sh and sourcing.
if [ true != "$INIT_D_SCRIPT_SOURCED" ] ; then
set "$0" "$@"; INIT_D_SCRIPT_SOURCED=true . /lib/init/init-d-script
fi
### BEGIN INIT INFO
# Provides: munin-async
# Required-Start: $local_fs $network $remote_fs $syslog
# Required-Stop: $local_fs $network $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Munin asyncd
# Description: Munin Asynchronous Proxy Node
# The Munin async daemon connects to a local
# munin node, retrieves results periodically,
# and stores them in a spool directory for fast
# retrieval.
### END INIT INFO
NAME=munin-async
DAEMON=/usr/bin/munin-asyncd
USER=munin-async
START_ARGS="--make-pidfile --background --user $USER --chuid $USER"
STOP_ARGS="--user $USER"
# keep in sync with debian/munin-async.tmpfile (systemd-only)
do_start_prepare() {
mkdir --mode=0775 -p /run/munin-async
chown munin-async.munin-async /run/munin-async
}
# difference compared to "do_start_cmd": remove "--exec" and "--name" parameters
do_start_cmd_override() {
start-stop-daemon --start --quiet ${PIDFILE:+--pidfile ${PIDFILE}} \
$START_ARGS --startas $DAEMON --test > /dev/null || return 1
start-stop-daemon --start --quiet ${PIDFILE:+--pidfile ${PIDFILE}} \
$START_ARGS --startas $DAEMON -- $DAEMON_ARGS || return 2
}
# difference compared to "do_stop_cmd": remove "--exec" and "--name" parameters
do_stop_cmd_override() {
start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 \
$STOP_ARGS \
${PIDFILE:+--pidfile ${PIDFILE}}
RETVAL="$?"
[ "$RETVAL" = 2 ] && return 2
start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 \
$STOP_ARGS \
${PIDFILE:+--pidfile ${PIDFILE}}
[ "$?" = 2 ] && return 2
rm -f $PIDFILE
return $RETVAL
}
|