From: Roland Rosenfeld Date: Sat, 14 Oct 2006 10:44:14 +0000 (+0000) Subject: Add LSB compliance to init.d script (INIT INFO and status). X-Git-Tag: v_3_0_6~45 X-Git-Url: http://www.privoxy.org/gitweb/?p=privoxy.git;a=commitdiff_plain;h=e0786740f1d0a00af35d9e0e5b29b60331297660 Add LSB compliance to init.d script (INIT INFO and status). --- diff --git a/debian/init.d b/debian/init.d index 9fc1a8f3..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 @@ -20,6 +34,7 @@ case "$1" in 2>> /var/log/privoxy/errorfile echo "$NAME." ;; + stop) echo -n "Stopping $DESC: " start-stop-daemon --oknodo --stop --quiet --pidfile $PIDFILE \ @@ -27,24 +42,8 @@ case "$1" in 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 -n "Restarting $DESC: " start-stop-daemon --oknodo --stop --quiet --pidfile $PIDFILE \ --exec $DAEMON @@ -54,10 +53,25 @@ case "$1" in 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