012668dab95e963b1e182e332a06494cbf137b79
[privoxy.git] / debian / init.d
1 #! /bin/sh
2
3 PATH=/sbin:/bin:/usr/sbin:/usr/bin
4 DAEMON=/usr/sbin/privoxy
5 NAME=privoxy
6 DESC="filtering proxy server"
7 OWNER=privoxy
8 CONFIGFILE=/etc/privoxy/config
9 PIDFILE=/var/run/$NAME.pid
10
11 test -f $DAEMON || exit 0
12
13 set -e
14
15 case "$1" in
16   start)
17         echo -n "Starting $DESC: "
18         start-stop-daemon --oknodo --start --quiet --pidfile $PIDFILE \
19             --exec $DAEMON -- --pidfile $PIDFILE --user $OWNER $CONFIGFILE \
20             2>/dev/null
21         echo "$NAME."
22         ;;
23   stop)
24         echo -n "Stopping $DESC: "
25         start-stop-daemon --oknodo --stop --quiet --pidfile $PIDFILE \
26                 --exec $DAEMON
27         echo "$NAME."
28         ;;
29   #reload)
30         #
31         #       If the daemon can reload its config files on the fly
32         #       for example by sending it SIGHUP, do it here.
33         #
34         #       If the daemon responds to changes in its config file
35         #       directly anyway, make this a do-nothing entry.
36         #
37         # echo "Reloading $DESC configuration files."
38         # start-stop-daemon --stop --signal 1 --quiet --pidfile \
39         #       /var/run/$NAME.pid --exec $DAEMON
40   #;;
41   restart|force-reload)
42         #
43         #       If the "reload" option is implemented, move the "force-reload"
44         #       option to the "reload" entry above. If not, "force-reload" is
45         #       just the same as "restart".
46         #
47         echo "Restarting $DESC: "
48         start-stop-daemon --oknodo --stop --quiet --pidfile $PIDFILE \
49                 --exec $DAEMON
50         sleep 1
51         start-stop-daemon --oknodo --start --quiet --pidfile $PIDFILE \
52             --exec $DAEMON -- --pidfile $PIDFILE --user $OWNER $CONFIGFILE
53         ;;
54   *)
55         N=/etc/init.d/$NAME
56         # echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2
57         echo "Usage: $N {start|stop|restart|force-reload}" >&2
58         exit 1
59         ;;
60 esac
61
62 exit 0