Created
November 11, 2017 19:43
-
-
Save nbari/9d64e74efc5937a7c985766fade0db2c to your computer and use it in GitHub Desktop.
immortal start-stop-daemon script (/etc/init.d/immortaldir)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# immortaldir start-stop-daemon | |
set -e | |
NAME=immortaldir | |
PIDFILE=/var/run/$NAME.pid | |
DAEMON=/usr/bin/immortaldir | |
DAEMON_OPTS="/etc/immortal" | |
export PATH="${PATH:+$PATH:}/usr/sbin:/sbin" | |
case "$1" in | |
start) | |
echo -n "Starting daemon: "$NAME | |
start-stop-daemon --start \ | |
--quiet \ | |
--oknodo \ | |
--make-pidfile \ | |
--pidfile $PIDFILE \ | |
--background \ | |
--startas /bin/sh \ | |
-- -c "exec $DAEMON $DAEMON_OPTS 2>&1 | logger -t immortaldir" | |
echo "." | |
;; | |
stop) | |
echo -n "Stopping daemon: "$NAME | |
pkill $NAME | |
echo "." | |
;; | |
*) | |
echo "Usage: "$1" {start|stop}" | |
exit 1 | |
esac | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment