developer-manual: Add more build instructions for Debian
[privoxy.git] / debian / init.d
index baec749..d089d73 100644 (file)
@@ -22,7 +22,7 @@ PATH=/sbin:/usr/sbin:/bin:/usr/bin
 DESC="filtering proxy server"
 NAME=privoxy
 DAEMON=/usr/sbin/$NAME
-PIDFILE=/var/run/$NAME.pid
+PIDFILE=/run/$NAME.pid
 OWNER=privoxy
 CONFIGFILE=/etc/privoxy/config
 DAEMON_ARGS="--pidfile $PIDFILE --user $OWNER $CONFIGFILE"
@@ -42,9 +42,6 @@ if [ ! -d "$LOGDIR" ]; then
     chown $OWNER:adm $LOGDIR
 fi
 
-# Load the VERBOSE setting and other rcS variables
-. /lib/init/vars.sh
-
 # Define LSB log_* functions.
 # Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
 . /lib/lsb/init-functions
@@ -97,13 +94,13 @@ do_stop()
 #
 # Function that sends a SIGHUP to the daemon/service
 #
-do_reload() {
+do_rotate() {
        #
        # If the daemon can reload its configuration without
        # restarting (for example, when it is sent a SIGHUP),
        # then implement that here.
        #
-       start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name $NAME
+       start-stop-daemon --stop --signal HUP --quiet --pidfile $PIDFILE --name $NAME
        return 0
 }
 
@@ -111,23 +108,23 @@ do_reload() {
 case "$1" in
   start)
        if [ "$RUN_DAEMON" = "no" ]; then
-            [ "$VERBOSE" != no ] && log_warning_msg "Not starting $DESC (disabled in $DEFAULTSFILE)."
+            log_warning_msg "Not starting $DESC (disabled in $DEFAULTSFILE)."
             exit 0
        fi
 
-       [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
+       log_daemon_msg "Starting $DESC" "$NAME"
        do_start
        case "$?" in
-               0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
-               2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
+               0|1) log_end_msg 0 ;;
+               2) log_end_msg 1 ;;
        esac
        ;;
   stop)
-       [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
+       log_daemon_msg "Stopping $DESC" "$NAME"
        do_stop
        case "$?" in
-               0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
-               2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
+               0|1) log_end_msg 0 ;;
+               2) log_end_msg 1 ;;
        esac
        ;;
   #reload|force-reload)
@@ -139,13 +136,18 @@ case "$1" in
        #do_reload
        #log_end_msg $?
        #;;
+  rotate)
+       log_daemon_msg "Closing open files" "$NAME"
+       do_rotate
+       log_end_msg $?
+       ;;
   restart|force-reload)
        #
        # If the "reload" option is implemented then remove the
        # 'force-reload' alias
        #
        if [ "$RUN_DAEMON" = "no" ]; then
-            [ "$VERBOSE" != no ] && log_warning_msg "Not restarting $DESC (disabled in $DEFAULTSFILE)."
+            log_warning_msg "Not restarting $DESC (disabled in $DEFAULTSFILE)."
             exit 0
        fi
 
@@ -173,7 +175,7 @@ case "$1" in
 
   *)
        #echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
-       echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload|status}" >&2
+       echo "Usage: $SCRIPTNAME {start|stop|rotate|restart|force-reload|status}" >&2
        exit 3
        ;;
 esac