author | Tero Marttila <terom@fixme.fi> |
Sat, 19 Sep 2009 23:01:11 +0300 | |
changeset 32 | 4a2aa163a576 |
parent 28 | 91800c6af63b |
permissions | -rwxr-xr-x |
28
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
1 |
#! /bin/sh |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
2 |
### BEGIN INIT INFO |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
3 |
# Provides: fixbot-nexus |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
4 |
# Required-Start: $remote_fs |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
5 |
# Required-Stop: $remote_fs |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
6 |
# Default-Start: 2 3 4 5 |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
7 |
# Default-Stop: 0 1 6 |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
8 |
# Short-Description: FixBot Logwatch component |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
9 |
# Description: Reads a stream of log data from fifos/files, filters the messages, and passes them on to the nexus |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
10 |
### END INIT INFO |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
11 |
|
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
12 |
# Author: Tero Marttila <terom@fixme.fi> |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
13 |
|
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
14 |
# Do NOT "set -e" |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
15 |
|
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
16 |
# PATH should only include /usr/* if it runs after the mountnfs.sh script |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
17 |
PATH=/sbin:/usr/sbin:/bin:/usr/bin |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
18 |
|
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
19 |
# fixbot stuff |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
20 |
FIXBOT_NAME=fixbot-logwatch |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
21 |
# what plugin to run |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
22 |
TWISTD_PLUGIN=fixbot_logwatch |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
23 |
DESC="FixBot Logwatch component" |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
24 |
PIDFILE=/var/run/$FIXBOT_NAME.pid |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
25 |
SCRIPTNAME=/etc/init.d/$FIXBOT_NAME |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
26 |
# custom arguments to twistd(1) |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
27 |
TWISTD_ARGS= |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
28 |
# custom arguments to fixbot, see `twistd fixbot_logwatch --help` |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
29 |
FIXBOT_ARGS= |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
30 |
|
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
31 |
|
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
32 |
# twistd stuff |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
33 |
DAEMON_NAME=twistd |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
34 |
DAEMON=/usr/bin/$DAEMON_NAME |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
35 |
|
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
36 |
# Exit if the package is not installed |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
37 |
[ -x "$DAEMON" ] || exit 0 |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
38 |
|
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
39 |
# Read configuration variable file if it is present |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
40 |
[ -r /etc/default/$FIXBOT_NAME ] && . /etc/default/$FIXBOT_NAME |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
41 |
|
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
42 |
# what arguments we run with |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
43 |
DAEMON_ARGS="--pidfile=$PIDFILE $TWISTD_ARGS $TWISTD_PLUGIN $FIXBOT_ARGS" |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
44 |
|
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
45 |
# Load the VERBOSE setting and other rcS variables |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
46 |
. /lib/init/vars.sh |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
47 |
|
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
48 |
# Define LSB log_* functions. |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
49 |
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present. |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
50 |
. /lib/lsb/init-functions |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
51 |
|
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
52 |
# |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
53 |
# Function that starts the daemon/service |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
54 |
# |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
55 |
do_start() |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
56 |
{ |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
57 |
# Return |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
58 |
# 0 if daemon has been started |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
59 |
# 1 if daemon was already running |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
60 |
# 2 if daemon could not be started |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
61 |
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \ |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
62 |
|| return 1 |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
63 |
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \ |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
64 |
$DAEMON_ARGS \ |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
65 |
|| return 2 |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
66 |
# Add code here, if necessary, that waits for the process to be ready |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
67 |
# to handle requests from services started subsequently which depend |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
68 |
# on this one. As a last resort, sleep for some time. |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
69 |
} |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
70 |
|
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
71 |
# |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
72 |
# Function that stops the daemon/service |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
73 |
# |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
74 |
do_stop() |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
75 |
{ |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
76 |
# Return |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
77 |
# 0 if daemon has been stopped |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
78 |
# 1 if daemon was already stopped |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
79 |
# 2 if daemon could not be stopped |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
80 |
# other if a failure occurred |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
81 |
start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $DAEMON_NAME |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
82 |
RETVAL="$?" |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
83 |
[ "$RETVAL" = 2 ] && return 2 |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
84 |
# Wait for children to finish too if this is a daemon that forks |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
85 |
# and if the daemon is only ever run from this initscript. |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
86 |
# If the above conditions are not satisfied then add some other code |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
87 |
# that waits for the process to drop all resources that could be |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
88 |
# needed by services started subsequently. A last resort is to |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
89 |
# sleep for some time. |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
90 |
start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
91 |
[ "$?" = 2 ] && return 2 |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
92 |
# Many daemons don't delete their pidfiles when they exit. |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
93 |
rm -f $PIDFILE |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
94 |
return "$RETVAL" |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
95 |
} |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
96 |
|
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
97 |
# |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
98 |
# Function that sends a SIGHUP to the daemon/service |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
99 |
# |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
100 |
do_reload() { |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
101 |
# |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
102 |
# If the daemon can reload its configuration without |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
103 |
# restarting (for example, when it is sent a SIGHUP), |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
104 |
# then implement that here. |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
105 |
# |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
106 |
start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name $NAME_DAEMON |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
107 |
return 0 |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
108 |
} |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
109 |
|
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
110 |
case "$1" in |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
111 |
start) |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
112 |
[ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$FIXBOT_NAME" |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
113 |
do_start |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
114 |
case "$?" in |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
115 |
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;; |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
116 |
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;; |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
117 |
esac |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
118 |
;; |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
119 |
stop) |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
120 |
[ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$FIXBOT_NAME" |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
121 |
do_stop |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
122 |
case "$?" in |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
123 |
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;; |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
124 |
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;; |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
125 |
esac |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
126 |
;; |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
127 |
#reload|force-reload) |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
128 |
# |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
129 |
# If do_reload() is not implemented then leave this commented out |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
130 |
# and leave 'force-reload' as an alias for 'restart'. |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
131 |
# |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
132 |
#log_daemon_msg "Reloading $DESC" "$NAME" |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
133 |
#do_reload |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
134 |
#log_end_msg $? |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
135 |
#;; |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
136 |
restart|force-reload) |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
137 |
# |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
138 |
# If the "reload" option is implemented then remove the |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
139 |
# 'force-reload' alias |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
140 |
# |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
141 |
log_daemon_msg "Restarting $DESC" "$FIXBOT_NAME" |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
142 |
do_stop |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
143 |
case "$?" in |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
144 |
0|1) |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
145 |
do_start |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
146 |
case "$?" in |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
147 |
0) log_end_msg 0 ;; |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
148 |
1) log_end_msg 1 ;; # Old process is still running |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
149 |
*) log_end_msg 1 ;; # Failed to start |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
150 |
esac |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
151 |
;; |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
152 |
*) |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
153 |
# Failed to stop |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
154 |
log_end_msg 1 |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
155 |
;; |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
156 |
esac |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
157 |
;; |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
158 |
*) |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
159 |
#echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2 |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
160 |
echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2 |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
161 |
exit 3 |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
162 |
;; |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
163 |
esac |
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
164 |
|
91800c6af63b
typos, and same stuff for fixbot-logwatch
Tero Marttila <terom@fixme.fi>
parents:
diff
changeset
|
165 |
: |