6769a532b6a9d1c01f5cfa73a5e54d1777c63138
4 # Required-Start: $local_fs $remote_fs
5 # Required-Stop: $local_fs $remote_fs
6 # Default-Start: 2 3 4 5
8 # Short-Description: Start port forwarding server
9 # Description: This file should be used to construct scripts to be
10 # placed in /etc/init.d.
13 # Author: Mark Wooding <mdw@distorted.org.uk>
17 # PATH should only include /usr/* if it runs after the mountnfs.sh script
18 PATH
=/sbin
:/usr
/sbin
:/bin
:/usr
/bin
19 DESC
="port forwarding daemon"
22 PIDFILE
=/var
/run
/$NAME.pid
23 SCRIPTNAME
=/etc
/init.d
/$NAME
25 DAEMON_ARGS
="--syslog"
28 # Exit if the package is not installed
29 [ -x
"$DAEMON" ] ||
exit 0
31 # Read configuration variable file if it is present
32 [ -r
/etc
/default
/$NAME ] && .
/etc
/default
/$NAME
34 # Exit if no configuration file
35 [ -r
"$CONFIG" ] ||
exit 0
37 # Load the VERBOSE setting and other rcS variables
40 # Define LSB log_* functions.
41 # Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
42 .
/lib
/lsb
/init-functions
45 # Function that starts the daemon/service
50 # 0 if daemon has been started
51 # 1 if daemon was already running
52 # 2 if daemon could not be started
53 start-stop-daemon
--start
--quiet
--pidfile
$PIDFILE \
54 --exec $DAEMON --test > /dev
/null \
56 start-stop-daemon
--start
--quiet
--pidfile
$PIDFILE \
58 --pidfile
="$PIDFILE" \
61 --setuid
="$FWUSER" --setgid
="$FWGROUP" \
67 # Function that stops the daemon/service
72 # 0 if daemon has been stopped
73 # 1 if daemon was already stopped
74 # 2 if daemon could not be stopped
75 # other if a failure occurred
76 start-stop-daemon
--stop
--quiet
--retry
=TERM
/30/KILL
/5 \
77 --pidfile
"$PIDFILE" --name
$NAME
79 [ "$RETVAL" = 2 ] && return 2
85 # Function that sends a SIGHUP to the daemon/service
89 # If the daemon can reload its configuration without
90 # restarting (for example, when it is sent a SIGHUP),
91 # then implement that here.
93 start-stop-daemon
--stop
--signal
1 --quiet
--pidfile
"$PIDFILE" \
100 [ "$VERBOSE" != no
] && log_daemon_msg
"Starting $DESC" "$NAME"
103 0|
1) [ "$VERBOSE" != no
] && log_end_msg
0 ;;
104 2) [ "$VERBOSE" != no
] && log_end_msg
1 ;;
108 [ "$VERBOSE" != no
] && log_daemon_msg
"Stopping $DESC" "$NAME"
111 0|
1) [ "$VERBOSE" != no
] && log_end_msg
0 ;;
112 2) [ "$VERBOSE" != no
] && log_end_msg
1 ;;
116 log_daemon_msg
"Reloading $DESC" "$NAME"
121 log_daemon_msg
"Restarting $DESC" "$NAME"
128 1) log_end_msg
1 ;; # Old process is still running
129 *) log_end_msg
1 ;; # Failed to start
139 echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2