X-Git-Url: http://www.privoxy.org/gitweb/?a=blobdiff_plain;f=debian%2Finit.d;h=8f65c9a1312f6f304df811a8619d1c653e64f976;hb=c158c4e4164225dbe8f02a856a4936297307f9d8;hp=cca3a8befc724868d068781f67875dd68e67a35b;hpb=71aad3f90226d3a65014c6fff4f2fc7ea37c3b58;p=privoxy.git diff --git a/debian/init.d b/debian/init.d index cca3a8be..8f65c9a1 100644 --- a/debian/init.d +++ b/debian/init.d @@ -1,5 +1,19 @@ #! /bin/sh +### BEGIN INIT INFO +# Provides: privoxy +# Required-Start: $local_fs $remote_fs $network $time +# Required-Stop: $local_fs $remote_fs $network $time +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Privacy enhancing HTTP Proxy +# Description: Privoxy is a web proxy with advanced filtering +# capabilities for protecting privacy, filtering +# web page content, managing cookies, controlling +# access, and removing ads, banners, pop-ups and +# other obnoxious Internet junk. +### END INIT INFO + PATH=/sbin:/bin:/usr/sbin:/usr/bin DAEMON=/usr/sbin/privoxy NAME=privoxy @@ -15,43 +29,49 @@ set -e case "$1" in start) echo -n "Starting $DESC: " - $DAEMON --pidfile $PIDFILE --user $OWNER $CONFIGFILE 2>/dev/null - echo "$NAME." + start-stop-daemon --oknodo --start --quiet --pidfile $PIDFILE \ + --exec $DAEMON -- --pidfile $PIDFILE --user $OWNER $CONFIGFILE \ + 2>> /var/log/privoxy/errorfile + echo "$NAME." ;; + stop) echo -n "Stopping $DESC: " start-stop-daemon --oknodo --stop --quiet --pidfile $PIDFILE \ --exec $DAEMON + rm -f $PIDFILE echo "$NAME." ;; - #reload) - # - # If the daemon can reload its config files on the fly - # for example by sending it SIGHUP, do it here. - # - # If the daemon responds to changes in its config file - # directly anyway, make this a do-nothing entry. - # - # echo "Reloading $DESC configuration files." - # start-stop-daemon --stop --signal 1 --quiet --pidfile \ - # /var/run/$NAME.pid --exec $DAEMON - #;; + restart|force-reload) - # - # If the "reload" option is implemented, move the "force-reload" - # option to the "reload" entry above. If not, "force-reload" is - # just the same as "restart". - # - echo "Restarting $DESC: " + echo -n "Restarting $DESC: " start-stop-daemon --oknodo --stop --quiet --pidfile $PIDFILE \ --exec $DAEMON sleep 1 - $DAEMON --pidfile $PIDFILE --user $OWNER $CONFIGFILE + start-stop-daemon --oknodo --start --quiet --pidfile $PIDFILE \ + --exec $DAEMON -- --pidfile $PIDFILE --user $OWNER $CONFIGFILE \ + 2>> /var/log/privoxy/errorfile + echo "$NAME." ;; + + status) + echo -n "Status of $DESC: " + if [ ! -r "$PIDFILE" ]; then + echo "$NAME is not running." + exit 3 + fi + if read pid < "$PIDFILE" && ps -p "$pid" > /dev/null 2>&1; then + echo "$NAME is running." + exit 0 + else + echo "$NAME is not running but $PIDFILE exists." + exit 1 + fi + ;; + *) N=/etc/init.d/$NAME - # echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2 - echo "Usage: $N {start|stop|restart|force-reload}" >&2 + echo "Usage: $N {start|stop|restart|force-reload|status}" >&2 exit 1 ;; esac