wok annotate privoxy/stuff/daemon-privoxy @ rev 22407
Add knot-dns (again)
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Tue Dec 10 16:56:23 2019 +0100 (2019-12-10) |
parents | b6858242c35f |
children |
rev | line source |
---|---|
paul@2275 | 1 #!/bin/sh |
al@19159 | 2 # /etc/init.d/daemon-name: Start, stop and restart daemon |
paul@2275 | 3 # on SliTaz, at boot time or with the command line. |
paul@2275 | 4 # |
paul@2275 | 5 # To start daemon at boot time, just put the right name in the $RUN_DAEMONS |
paul@2275 | 6 # variable of /etc/rcS.conf and configure options with /etc/daemons.conf. |
paul@2275 | 7 # |
paul@2275 | 8 . /etc/init.d/rc.functions |
paul@2275 | 9 . /etc/daemons.conf |
paul@2275 | 10 |
paul@2275 | 11 NAME=Privoxy |
al@19159 | 12 DESC="$(_ 'Web proxy daemon')" |
paul@2275 | 13 DAEMON=/usr/sbin/privoxy |
paul@2275 | 14 OPTIONS="--pidfile /var/run/privoxy.pid" |
paul@2275 | 15 USER="--user privoxy" |
paul@2275 | 16 CONFIG=/etc/privoxy/config |
paul@2275 | 17 PIDFILE=/var/run/privoxy.pid |
paul@2275 | 18 |
paul@2275 | 19 case "$1" in |
paul@2275 | 20 start) |
pascal@11692 | 21 if active_pidfile $PIDFILE privoxy ; then |
al@19159 | 22 _ '%s is already running.' $NAME |
paul@2275 | 23 exit 1 |
paul@2275 | 24 fi |
al@19159 | 25 action 'Starting %s: %s...' "$DESC" $NAME |
al@19159 | 26 $DAEMON $OPTIONS $USER $CONFIG 2>/dev/null |
paul@2275 | 27 status |
paul@2275 | 28 ;; |
paul@2275 | 29 stop) |
pascal@11692 | 30 if ! active_pidfile $PIDFILE privoxy ; then |
al@19159 | 31 _ '%s is not running.' $NAME |
paul@2275 | 32 exit 1 |
paul@2275 | 33 fi |
al@19159 | 34 action 'Stopping %s: %s...' "$DESC" $NAME |
al@19159 | 35 kill $(cat $PIDFILE) |
paul@2275 | 36 rm $PIDFILE |
paul@2275 | 37 status |
paul@2275 | 38 ;; |
paul@2275 | 39 restart) |
pascal@11692 | 40 if ! active_pidfile $PIDFILE privoxy ; then |
al@19159 | 41 _ '%s is not running.' $NAME |
paul@2275 | 42 exit 1 |
paul@2275 | 43 fi |
al@19159 | 44 kill $(cat $PIDFILE) |
paul@2275 | 45 rm $PIDFILE |
paul@2275 | 46 sleep 2 |
al@19159 | 47 action 'Restarting %s: %s...' "$DESC" $NAME |
al@19159 | 48 $DAEMON $OPTIONS $USER $CONFIG 2>/dev/null |
paul@2275 | 49 status |
paul@2275 | 50 ;; |
paul@2275 | 51 *) |
al@19159 | 52 emsg "<n><b>$(_ 'Usage:')</b> $0 [start|stop|restart]" |
al@19159 | 53 newline |
paul@2275 | 54 exit 1 |
paul@2275 | 55 ;; |
paul@2275 | 56 esac |
paul@2275 | 57 |
paul@2275 | 58 exit 0 |