rev |
line source |
paul@2275
|
1 #!/bin/sh
|
paul@2275
|
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
|
paul@2275
|
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)
|
paul@2275
|
21 if [ -f $PIDFILE ] ; then
|
paul@2275
|
22 echo "$NAME already running."
|
paul@2275
|
23 exit 1
|
paul@2275
|
24 fi
|
paul@2275
|
25 echo -n "Starting $DESC: $NAME... "
|
paul@2275
|
26 $DAEMON $OPTIONS $USER $CONFIG 2> /dev/null
|
paul@2275
|
27 status
|
paul@2275
|
28 ;;
|
paul@2275
|
29 stop)
|
paul@2275
|
30 if [ ! -f $PIDFILE ] ; then
|
paul@2275
|
31 echo "$NAME is not running."
|
paul@2275
|
32 exit 1
|
paul@2275
|
33 fi
|
paul@2275
|
34 echo -n "Stopping $DESC: $NAME... "
|
paul@2275
|
35 kill `cat $PIDFILE`
|
paul@2275
|
36 rm $PIDFILE
|
paul@2275
|
37 status
|
paul@2275
|
38 ;;
|
paul@2275
|
39 restart)
|
paul@2275
|
40 if [ ! -f $PIDFILE ] ; then
|
paul@2275
|
41 echo "$NAME is not running."
|
paul@2275
|
42 exit 1
|
paul@2275
|
43 fi
|
paul@2275
|
44 kill `cat $PIDFILE`
|
paul@2275
|
45 rm $PIDFILE
|
paul@2275
|
46 sleep 2
|
paul@2275
|
47 echo -n "Restarting $DESC: $NAME... "
|
paul@2275
|
48 $DAEMON $OPTIONS $USER $CONFIG 2> /dev/null
|
paul@2275
|
49 status
|
paul@2275
|
50 ;;
|
paul@2275
|
51 *)
|
paul@2275
|
52 echo ""
|
paul@2275
|
53 echo -e "\033[1mUsage:\033[0m /etc/init.d/`basename $0` [start|stop|restart]"
|
paul@2275
|
54 echo ""
|
paul@2275
|
55 exit 1
|
paul@2275
|
56 ;;
|
paul@2275
|
57 esac
|
paul@2275
|
58
|
paul@2275
|
59 exit 0
|