4
# Required-Start: $remote_fs $syslog
5
# Required-Stop: $remote_fs $syslog
6
# Default-Start: 2 3 4 5
8
# Short-Description: Initscript for ahcpd
9
# Description: Initscript for Ad-Hoc Configuration Protocol daemon
12
# Author: Stéphane Glondu <glondu@debian.org>
14
# Based on /etc/init.d/skeleton from initscripts_2.87dsf-10 and an
15
# initscript provided by Juliusz Chroboczek.
19
# PATH should only include /usr/* if it runs after the mountnfs.sh script
20
PATH=/sbin:/usr/sbin:/bin:/usr/bin
21
DESC="Ad-Hoc Configuration Protocol daemon"
23
DAEMON=/usr/sbin/$NAME
24
PIDFILE=/var/run/$NAME.pid
25
SCRIPTNAME=/etc/init.d/$NAME
27
# Exit if the package is not installed
28
[ -x "$DAEMON" ] || exit 0
30
# Read configuration variable file if it is present
31
[ -r /etc/default/$NAME ] && . /etc/default/$NAME
33
# Exit if there is no interfaces
34
if [ -z "$INTERFACES" ]; then
35
echo "$DESC: no interfaces to operate on"
39
# Load the VERBOSE setting and other rcS variables
42
# Define LSB log_* functions.
43
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
44
. /lib/lsb/init-functions
49
# 0 if daemon has been started
50
# 1 if daemon was already running
51
# 2 if daemon could not be started
52
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \
54
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \
55
-D -I $PIDFILE $DAEMON_ARGS $INTERFACES \
57
# Wait for the daemon to be ready
59
[ -e $PIDFILE ] || sleep 4
60
[ -e $PIDFILE ] || return 2
66
# 0 if daemon has been stopped
67
# 1 if daemon was already stopped
68
# 2 if daemon could not be stopped
69
# other if a failure occurred
70
start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME
75
[ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
78
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
79
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
83
[ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
86
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
87
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
91
status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
94
log_daemon_msg "Restarting $DESC" "$NAME"
101
1) log_end_msg 1 ;; # Old process is still running
102
*) log_end_msg 1 ;; # Failed to start
112
echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2