4 # Required-Start: $local_fs $remote_fs $network $time
5 # Required-Stop: $local_fs $remote_fs $network $time
6 # Default-Start: 2 3 4 5
8 # Short-Description: Privacy enhancing HTTP Proxy
9 # Description: Privoxy is a web proxy with advanced filtering
10 # capabilities for protecting privacy, filtering
11 # web page content, managing cookies, controlling
12 # access, and removing ads, banners, pop-ups and
13 # other obnoxious Internet junk.
16 # Author: Roland Rosenfeld <roland@debian.org>
20 # PATH should only include /usr/* if it runs after the mountnfs.sh script
21 PATH=/sbin:/usr/sbin:/bin:/usr/bin
22 DESC="filtering proxy server"
24 DAEMON=/usr/sbin/$NAME
25 PIDFILE=/var/run/$NAME.pid
27 CONFIGFILE=/etc/privoxy/config
28 DAEMON_ARGS="--pidfile $PIDFILE --user $OWNER $CONFIGFILE"
29 SCRIPTNAME=/etc/init.d/$NAME
30 LOGDIR=/var/log/privoxy
31 DEFAULTSFILE=/etc/default/$NAME
33 # Exit if the package is not installed
34 [ -x "$DAEMON" ] || exit 0
36 # Read configuration variable file if it is present
37 [ -r $DEFAULTSFILE ] && . $DEFAULTSFILE
39 # Create log directory if it does not exist
40 if [ ! -d "$LOGDIR" ]; then
42 chown $OWNER:adm $LOGDIR
45 # Load the VERBOSE setting and other rcS variables
48 # Define LSB log_* functions.
49 # Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
50 . /lib/lsb/init-functions
53 # Function that starts the daemon/service
58 # 0 if daemon has been started
59 # 1 if daemon was already running
60 # 2 if daemon could not be started
61 start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \
63 start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \
66 # Add code here, if necessary, that waits for the process to be ready
67 # to handle requests from services started subsequently which depend
68 # on this one. As a last resort, sleep for some time.
72 # Function that stops the daemon/service
77 # 0 if daemon has been stopped
78 # 1 if daemon was already stopped
79 # 2 if daemon could not be stopped
80 # other if a failure occurred
81 start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME
83 [ "$RETVAL" = 2 ] && return 2
84 # Wait for children to finish too if this is a daemon that forks
85 # and if the daemon is only ever run from this initscript.
86 # If the above conditions are not satisfied then add some other code
87 # that waits for the process to drop all resources that could be
88 # needed by services started subsequently. A last resort is to
89 # sleep for some time.
90 start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON
91 [ "$?" = 2 ] && return 2
92 # Many daemons don't delete their pidfiles when they exit.
98 # Function that sends a SIGHUP to the daemon/service
102 # If the daemon can reload its configuration without
103 # restarting (for example, when it is sent a SIGHUP),
104 # then implement that here.
106 start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name $NAME
113 if [ "$RUN_DAEMON" = "no" ]; then
114 [ "$VERBOSE" != no ] && log_warning_msg "Not starting $DESC (disabled in $DEFAULTSFILE)."
118 [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
121 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
122 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
126 [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
129 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
130 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
133 #reload|force-reload)
135 # If do_reload() is not implemented then leave this commented out
136 # and leave 'force-reload' as an alias for 'restart'.
138 #log_daemon_msg "Reloading $DESC" "$NAME"
142 restart|force-reload)
144 # If the "reload" option is implemented then remove the
145 # 'force-reload' alias
147 if [ "$RUN_DAEMON" = "no" ]; then
148 [ "$VERBOSE" != no ] && log_warning_msg "Not restarting $DESC (disabled in $DEFAULTSFILE)."
152 log_daemon_msg "Restarting $DESC" "$NAME"
159 1) log_end_msg 1 ;; # Old process is still running
160 *) log_end_msg 1 ;; # Failed to start
170 status_of_proc "$DAEMON" "$NAME"
175 #echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
176 echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload|status}" >&2