14 # Do NOT "set -e" |
14 # Do NOT "set -e" |
15 |
15 |
16 # PATH should only include /usr/* if it runs after the mountnfs.sh script |
16 # PATH should only include /usr/* if it runs after the mountnfs.sh script |
17 PATH=/sbin:/usr/sbin:/bin:/usr/bin |
17 PATH=/sbin:/usr/sbin:/bin:/usr/bin |
18 |
18 |
19 # fixbot stuff |
19 # twisted plugin to run |
20 FIXBOT_NAME=fixbot-nexus |
20 PLUGIN_NAME=fixbot-nexus |
21 # what plugin to run |
21 PLUGIN_DOC="FixBot Nexus component" |
22 TWISTD_PLUGIN=fixbot_nexus |
22 |
23 DESC="FixBot Nexus component" |
23 TWISTD_PIDFILE=/var/run/$PLUGIN_NAME.pid |
24 PIDFILE=/var/run/$FIXBOT_NAME.pid |
24 |
25 SCRIPTNAME=/etc/init.d/$FIXBOT_NAME |
|
26 # custom arguments to twistd(1) |
25 # custom arguments to twistd(1) |
27 TWISTD_ARGS= |
26 TWISTD_ARGS= |
28 # custom arguments to fixbot, see `twistd fixbot_nexus --help` |
27 # custom arguments to fixbot, see `twistd fixbot_nexus --help` |
29 FIXBOT_ARGS= |
28 PLUGIN_ARGS= |
30 |
29 |
31 |
30 |
32 # twistd stuff |
31 # the daemon we run is twistd |
33 DAEMON_NAME=twistd |
32 DAEMON_NAME=twistd |
34 DAEMON=/usr/bin/$DAEMON_NAME |
33 DAEMON=/usr/bin/$DAEMON_NAME |
35 |
34 |
36 # Exit if the package is not installed |
35 # Exit if the package is not installed |
37 [ -x "$DAEMON" ] || exit 0 |
36 [ -x "$DAEMON" ] || exit 0 |
38 |
37 |
39 # Read configuration variable file if it is present |
38 # Read configuration variable file if it is present |
40 [ -r /etc/default/$FIXBOT_NAME ] && . /etc/default/$FIXBOT_NAME |
39 [ -r /etc/default/$PLUGIN_NAME ] && . /etc/default/$PLUGIN_NAME |
41 |
40 |
42 # what arguments we run with |
41 # what arguments we run with |
43 DAEMON_ARGS="--pidfile=$PIDFILE $TWISTD_ARGS $TWISTD_PLUGIN $FIXBOT_ARGS" |
42 DAEMON_ARGS="--pidfile=$PIDFILE $TWISTD_ARGS $PLUGIN_NAME $PLUGIN_ARGS" |
44 |
43 |
45 # Load the VERBOSE setting and other rcS variables |
44 # Load the VERBOSE setting and other rcS variables |
46 . /lib/init/vars.sh |
45 . /lib/init/vars.sh |
47 |
46 |
48 # Define LSB log_* functions. |
47 # Define LSB log_* functions. |
101 # |
100 # |
102 # If the daemon can reload its configuration without |
101 # If the daemon can reload its configuration without |
103 # restarting (for example, when it is sent a SIGHUP), |
102 # restarting (for example, when it is sent a SIGHUP), |
104 # then implement that here. |
103 # then implement that here. |
105 # |
104 # |
106 start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name $NAME_DAEMON |
105 start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name $DAEMON_NAME |
107 return 0 |
106 return 0 |
108 } |
107 } |
109 |
108 |
110 case "$1" in |
109 case "$1" in |
111 start) |
110 start) |
112 [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$FIXBOT_NAME" |
111 [ "$VERBOSE" != no ] && log_daemon_msg "Starting $PLUGIN_DESC" "$PLUGIN_NAME" |
113 do_start |
112 do_start |
114 case "$?" in |
113 case "$?" in |
115 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;; |
114 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;; |
116 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;; |
115 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;; |
117 esac |
116 esac |
118 ;; |
117 ;; |
119 stop) |
118 stop) |
120 [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$FIXBOT_NAME" |
119 [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $PLUGIN_DESC" "$PLUGIN_NAME" |
121 do_stop |
120 do_stop |
122 case "$?" in |
121 case "$?" in |
123 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;; |
122 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;; |
124 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;; |
123 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;; |
125 esac |
124 esac |