wok-stable view privoxy/stuff/daemon-privoxy @ rev 8842

Up: tazwok 4.2.1
author Antoine Bodin <gokhlayeh@slitaz.org>
date Fri Feb 25 00:21:51 2011 +0100 (2011-02-25)
parents
children b6858242c35f
line source
1 #!/bin/sh
2 # /etc/init.d/daemon-name: Start, stop and restart daemon
3 # on SliTaz, at boot time or with the command line.
4 #
5 # To start daemon at boot time, just put the right name in the $RUN_DAEMONS
6 # variable of /etc/rcS.conf and configure options with /etc/daemons.conf.
7 #
8 . /etc/init.d/rc.functions
9 . /etc/daemons.conf
11 NAME=Privoxy
12 DESC="Web proxy daemon"
13 DAEMON=/usr/sbin/privoxy
14 OPTIONS="--pidfile /var/run/privoxy.pid"
15 USER="--user privoxy"
16 CONFIG=/etc/privoxy/config
17 PIDFILE=/var/run/privoxy.pid
19 case "$1" in
20 start)
21 if [ -f $PIDFILE ] ; then
22 echo "$NAME already running."
23 exit 1
24 fi
25 echo -n "Starting $DESC: $NAME... "
26 $DAEMON $OPTIONS $USER $CONFIG 2> /dev/null
27 status
28 ;;
29 stop)
30 if [ ! -f $PIDFILE ] ; then
31 echo "$NAME is not running."
32 exit 1
33 fi
34 echo -n "Stopping $DESC: $NAME... "
35 kill `cat $PIDFILE`
36 rm $PIDFILE
37 status
38 ;;
39 restart)
40 if [ ! -f $PIDFILE ] ; then
41 echo "$NAME is not running."
42 exit 1
43 fi
44 kill `cat $PIDFILE`
45 rm $PIDFILE
46 sleep 2
47 echo -n "Restarting $DESC: $NAME... "
48 $DAEMON $OPTIONS $USER $CONFIG 2> /dev/null
49 status
50 ;;
51 *)
52 echo ""
53 echo -e "\033[1mUsage:\033[0m /etc/init.d/`basename $0` [start|stop|restart]"
54 echo ""
55 exit 1
56 ;;
57 esac
59 exit 0