4 # Required-Start: $local_fs $remote_fs $named $network $time
5 # Required-Stop: $local_fs $remote_fs $named $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 # Define LSB log_* functions.
46 # Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
47 . /lib/lsb/init-functions
50 # Function that starts the daemon/service
55 # 0 if daemon has been started
56 # 1 if daemon was already running
57 # 2 if daemon could not be started
58 start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \
60 start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \
63 # Add code here, if necessary, that waits for the process to be ready
64 # to handle requests from services started subsequently which depend
65 # on this one. As a last resort, sleep for some time.
69 # Function that stops the daemon/service
74 # 0 if daemon has been stopped
75 # 1 if daemon was already stopped
76 # 2 if daemon could not be stopped
77 # other if a failure occurred
78 start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME
80 [ "$RETVAL" = 2 ] && return 2
81 # Wait for children to finish too if this is a daemon that forks
82 # and if the daemon is only ever run from this initscript.
83 # If the above conditions are not satisfied then add some other code
84 # that waits for the process to drop all resources that could be
85 # needed by services started subsequently. A last resort is to
86 # sleep for some time.
87 start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON
88 [ "$?" = 2 ] && return 2
89 # Many daemons don't delete their pidfiles when they exit.
95 # Function that sends a SIGHUP to the daemon/service
99 # If the daemon can reload its configuration without
100 # restarting (for example, when it is sent a SIGHUP),
101 # then implement that here.
103 start-stop-daemon --stop --signal HUP --quiet --pidfile $PIDFILE --name $NAME
110 if [ "$RUN_DAEMON" = "no" ]; then
111 log_warning_msg "Not starting $DESC (disabled in $DEFAULTSFILE)."
115 log_daemon_msg "Starting $DESC" "$NAME"
118 0|1) log_end_msg 0 ;;
123 log_daemon_msg "Stopping $DESC" "$NAME"
126 0|1) log_end_msg 0 ;;
130 #reload|force-reload)
132 # If do_reload() is not implemented then leave this commented out
133 # and leave 'force-reload' as an alias for 'restart'.
135 #log_daemon_msg "Reloading $DESC" "$NAME"
140 log_daemon_msg "Closing open files" "$NAME"
144 restart|force-reload)
146 # If the "reload" option is implemented then remove the
147 # 'force-reload' alias
149 if [ "$RUN_DAEMON" = "no" ]; then
150 log_warning_msg "Not restarting $DESC (disabled in $DEFAULTSFILE)."
154 log_daemon_msg "Restarting $DESC" "$NAME"
161 1) log_end_msg 1 ;; # Old process is still running
162 *) log_end_msg 1 ;; # Failed to start
172 status_of_proc "$DAEMON" "$NAME"
177 #echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
178 echo "Usage: $SCRIPTNAME {start|stop|rotate|restart|force-reload|status}" >&2