Created
January 3, 2021 16:58
-
-
Save socram8888/3087ac96615580556c554397cfc7c095 to your computer and use it in GitHub Desktop.
Stubby sysvinit init script
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 | |
### BEGIN INIT INFO | |
# Provides: stubby | |
# Required-Start: $local_fs $network | |
# Required-Stop: $local_fs | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: stubby service | |
# Description: stubby, the secure DNS proxy | |
### END INIT INFO | |
PATH=/bin:/usr/bin:/sbin:/usr/sbin | |
NAME=stubby | |
DAEMON=/usr/bin/stubby | |
PIDFILE=/run/stubby.pid | |
CONFIG=/etc/stubby/stubby.yml | |
USER=stubby | |
test -f $DAEMON || exit 0 | |
. /lib/lsb/init-functions | |
case "$1" in | |
start) | |
log_daemon_msg "Starting $NAME" | |
touch $PIDFILE | |
chown $USER $PIDFILE | |
chmod 700 $PIDFILE | |
start-stop-daemon --start --exec $DAEMON --pidfile $PIDFILE --chuid $USER --quiet --oknodo -- -C $CONFIG -g | |
log_end_msg $? | |
exit $? | |
;; | |
stop) | |
log_daemon_msg "Stopping $NAME" | |
start-stop-daemon --stop --exec $DAEMON --pidfile $PIDFILE --remove-pidfile --user $USER --quiet --oknodo | |
log_end_msg $? | |
exit $? | |
;; | |
restart) | |
$0 stop && $0 start | |
exit $? | |
;; | |
status) | |
status_of_proc -p "$PIDFILE" "$DAEMON" "$NAME" | |
exit $? | |
;; | |
*) | |
echo "Usage: $0 {start|stop|restart|status}" | |
exit 1 | |
;; | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@no-systemd sure, go ahead!