18
18
# Most configuration options in /etc/default/dnsmasq are deprecated
19
19
# but still honoured.
21
22
if [ -r /etc/default/$NAME ]; then
22
23
. /etc/default/$NAME
26
test "$ENABLED" != "0" || exit 0
25
27
test -x $DAEMON || exit 0
29
# Provide skeleton LSB log functions for backports which don't have LSB functions.
30
if [ -f /lib/lsb/init-functions ]; then
31
. /lib/lsb/init-functions
28
47
# If the resolvconf package is installed then use the resolv conf file
29
48
# that it provides as the default. Otherwise use /etc/resolv.conf as
137
# 0 if daemon is running
138
# 1 if daemon is dead and pid file exists
139
# 3 if daemon is not running
140
# 4 if daemon status is unknown
141
start-stop-daemon --start --quiet --pidfile /var/run/$NAME.pid --exec $DAEMON --test > /dev/null
143
0) [ -e "/var/run/$NAME.pid" ] && return 1 ; return 3 ;;
117
echo -n "Starting $DESC: $NAME"
151
log_daemon_msg "Starting $DESC" "$NAME"
126
echo " (already running)."
160
log_warning_msg "already running"
165
log_warning_msg "failed"
137
echo -n "Stopping $DESC: $NAME"
173
log_daemon_msg "Stopping $DESC" "$NAME"
140
0) echo "." ; exit 0 ;;
141
1) echo " (not running)." ; exit 0 ;;
142
*) echo " (failed)." ; exit 1 ;;
176
0) log_end_msg 0 ; exit 0 ;;
177
1) log_warning_msg "not running" ; log_end_msg 0 ; exit 0 ;;
178
*) log_warning_msg "failed" ; log_end_msg 1 ; exit 1 ;;
145
181
restart|force-reload)
147
echo -n "Restarting $DESC: $NAME"
183
log_daemon_msg "Restarting $DESC" "$NAME"
159
echo " (failed -- old process is still running)."
195
log_warning_msg "failed -- old process is still running"
163
echo " (failed to start)."
200
log_warning_msg "failed to start"
169
echo " (failed to stop)."
207
log_warning_msg "failed to stop"
214
log_daemon_msg "Checking $DESC" "$NAME"
217
0) log_warning_msg "running" ; log_end_msg 0; exit 0 ;;
218
1) log_warning_msg "dead, pid file exists" ; log_end_msg 1; exit 1 ;;
219
3) log_warning_msg "not running" ; log_end_msg 3; exit 3 ;;
220
*) log_warning_msg "unknown" ; log_end_msg 4; exit 4 ;;
175
echo "Usage: /etc/init.d/$NAME {start|stop|restart|force-reload}" >&2
224
echo "Usage: /etc/init.d/$NAME {start|stop|restart|force-reload|status}" >&2