2 # ********************************************************************
3 # This script uses exit to return proper error codes,
4 # sourcing (. /path/to/rc.privoxy) it in your system's
5 # rc files is a bad idea.
6 # ********************************************************************
10 PRIVOXY_PRG="%PROGRAM%"
11 PRIVOXY_BIN="%SBIN_DEST%/$PRIVOXY_PRG"
12 PRIVOXY_CONF="%CONF_DEST%/config"
14 PRIVOXY_GROUP="%GROUP%"
15 PRIVOXY_PID="/var/run/$PRIVOXY_PRG.pid"
18 check=(`/bin/ps -e|/bin/grep $PRIVOXY_PRG|/usr/bin/wc -l`)
21 if [ ! -x $PRIVOXY_BIN ] ; then exit 0 ;fi
22 if [ ! -f $PRIVOXY_CONF ] ; then exit 0 ;fi
24 # See how we were called.
26 PRIVOXY="$PRIVOXY_BIN --user $PRIVOXY_USER.$PRIVOXY_GROUP --pidfile $PRIVOXY_PID $PRIVOXY_CONF"
30 echo -n $"Starting $PRIVOXY_PRG: "
32 if [ ! -f $PRIVOXY_PID ]; then
33 ( $PRIVOXY 2>/dev/tty9 ) \
35 && /bin/touch /var/lock/$PRIVOXY_PRG \
37 elif [ $check -lt 3 ]; then
38 echo "Zombie lock file found"
39 /bin/rm -f /var/lock/$PRIVOXY_PRG $PRIVOXY_PID
43 echo "Already running"
50 echo -n $"Stopping $PRIVOXY_PRG: "
51 if [ -f $PRIVOXY_PID ]; then
52 /bin/kill `/bin/cat $PRIVOXY_PID` \
53 && /bin/rm -f /var/lock/$PRIVOXY_PRG $PRIVOXY_PID \
70 if [ -f $PRIVOXY_PID ] ; then
71 /bin/kill -HUP `cat $PRIVOXY_PID` \
80 echo "Kill all Privoxy"
81 /bin/rm -f /var/lock/$PRIVOXY_PRG $PRIVOXY_PID
85 # restart only if already running
86 if [ -f $PRIVOXY_PID ] ; then
92 /bin/ps ax|/bin/grep $PRIVOXY_PRG|/bin/grep -v 'grep\|init\.d\|rc\.d'
96 if [ -f $PRIVOXY_PID ]; then
98 for i in `/sbin/pidof $PRIVOXY_PRG` ; do
105 echo $"Usage: $PRIVOXY_PRG {start|stop|reload|restart|condrestart|status|top|kill}"