4
# Required-Start: $remote_fs $syslog avahi
5
# Required-Stop: $remote_fs $syslog avahi
6
# Default-Start: 2 3 4 5
8
# Short-Description: Mandos server
9
# Description: Server of encrypted passwords to Mandos clients
12
# Author: Teddy Hogeborn <teddy@recompile.se>
13
# Author: Björn Påhlsson <belorn@recompile.se>
15
# Please remove the "Author" lines above and replace them
16
# with your own name if you copy and modify this script.
20
# PATH should only include /usr/* if it runs after the mountnfs.sh script
21
PATH=/sbin:/usr/sbin:/bin:/usr/bin
22
DESC="Mandos root file system password server"
24
DAEMON=/usr/sbin/$NAME
26
if [ -d /run/. ]; then
27
PIDFILE=/run/$NAME.pid
29
PIDFILE=/var/run/$NAME.pid
31
SCRIPTNAME=/etc/init.d/$NAME
33
# Exit if the package is not installed
34
[ -x "$DAEMON" ] || exit 0
36
# Read configuration variable file if it is present
37
[ -r /etc/default/$NAME ] && . /etc/default/$NAME
39
if [ -n "$CONFIGDIR" ]; then
40
DAEMON_ARGS="$DAEMON_ARGS --configdir $CONFIGDIR"
43
# Load the VERBOSE setting and other rcS variables
46
# Define LSB log_* functions.
47
# Depend on lsb-base (>= 3.2-14) to ensure that this file is present.
48
. /lib/lsb/init-functions
51
# Function that starts the daemon/service
56
# 0 if daemon has been started
57
# 1 if daemon was already running
58
# 2 if daemon could not be started
59
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \
61
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \
64
# Add code here, if necessary, that waits for the process to be ready
65
# to handle requests from services started subsequently which depend
66
# on this one. As a last resort, sleep for some time.
70
# Function that stops the daemon/service
75
# 0 if daemon has been stopped
76
# 1 if daemon was already stopped
77
# 2 if daemon could not be stopped
78
# other if a failure occurred
79
start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME
81
[ "$RETVAL" = 2 ] && return 2
82
# Wait for children to finish too if this is a daemon that forks
83
# and if the daemon is only ever run from this initscript.
84
# If the above conditions are not satisfied then add some other code
85
# that waits for the process to drop all resources that could be
86
# needed by services started subsequently. A last resort is to
87
# sleep for some time.
88
start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON
89
[ "$?" = 2 ] && return 2
90
# Many daemons don't delete their pidfiles when they exit.
96
# Function that sends a SIGHUP to the daemon/service
100
# If the daemon can reload its configuration without
101
# restarting (for example, when it is sent a SIGHUP),
102
# then implement that here.
104
start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name $NAME
110
[ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
113
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
114
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
118
[ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
121
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
122
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
125
#reload|force-reload)
127
# If do_reload() is not implemented then leave this commented out
128
# and leave 'force-reload' as an alias for 'restart'.
130
#log_daemon_msg "Reloading $DESC" "$NAME"
134
restart|force-reload)
136
# If the "reload" option is implemented then remove the
137
# 'force-reload' alias
139
log_daemon_msg "Restarting $DESC" "$NAME"
146
1) log_end_msg 1 ;; # Old process is still running
147
*) log_end_msg 1 ;; # Failed to start
157
status_of_proc "$DAEMON" "$NAME" -p "$PIDFILE"
160
#echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
161
echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2