4 # Required-Start: $local_fs $network $remote_fs $syslog mysql
5 # Required-Stop: $local_fs $network $remote_fs $syslog mysql
6 # Default-Start: 2 3 4 5
8 # Short-Description: <Enter a short description of the software>
9 # Description: <Enter a long description of the software>
14 # Author: CAcert Software Team <cacert-devel@cacert.org>
18 # PATH should only include /usr/* if it runs after the mountnfs.sh script
19 PATH=/sbin:/usr/sbin:/bin:/usr/bin
20 DESC="cacert's signer software"
21 NAME=cacert-cassiopeia
22 DAEMON=/usr/bin/cassiopeia
24 PIDFILE=/var/run/$NAME.pid
25 SCRIPTNAME=/etc/init.d/$NAME
26 DIR=/var/lib/cacert-gigi
28 # Exit if the package is not installed
29 [ -x "$DAEMON" ] || exit 0
31 # Read configuration variable file if it is present
32 [ -r /etc/default/$NAME ] && . /etc/default/$NAME
33 if [ "$START_DAEMON" = "0" ]; then
34 echo "Not starting $NAME (as configured in /etc/default/$NAME)";
38 # Load the VERBOSE setting and other rcS variables
41 # Define LSB log_* functions.
42 # Depend on lsb-base (>= 3.2-14) to ensure that this file is present
43 # and status_of_proc is working.
44 . /lib/lsb/init-functions
47 # Function that starts the daemon/service
51 if [ ! -f /etc/cacert/cassiopeia/cassiopeia.conf ]; then
52 echo Missing cassiopeia-configfile
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 -b --start --quiet --pidfile $PIDFILE -d $DIR --exec $DAEMON --test > /dev/null \
61 start-stop-daemon -b --start --quiet --pidfile $PIDFILE --make-pidfile -d $DIR -c nobody --exec $DAEMON --no-close -- \
62 >> /var/log/cacert-cassiopeia.log 2>&1 \
64 # The above code will not work for interpreted scripts, use the next
65 # six lines below instead (Ref: #643337, start-stop-daemon(8) )
66 # start-stop-daemon --start --quiet --pidfile $PIDFILE --startas $DAEMON \
67 # --name $NAME --test > /dev/null \
69 # start-stop-daemon --start --quiet --pidfile $PIDFILE --startas $DAEMON \
70 # --name $NAME -- $DAEMON_ARGS \
73 # Add code here, if necessary, that waits for the process to be ready
74 # to handle requests from services started subsequently which depend
75 # on this one. As a last resort, sleep for some time.
79 # Function that stops the daemon/service
84 # 0 if daemon has been stopped
85 # 1 if daemon was already stopped
86 # 2 if daemon could not be stopped
87 # other if a failure occurred
88 start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE
90 [ "$RETVAL" = 2 ] && return 2
91 # Wait for children to finish too if this is a daemon that forks
92 # and if the daemon is only ever run from this initscript.
93 # If the above conditions are not satisfied then add some other code
94 # that waits for the process to drop all resources that could be
95 # needed by services started subsequently. A last resort is to
96 # sleep for some time.
97 start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --pidfile $PIDFILE
98 [ "$?" = 2 ] && return 2
99 # Many daemons don't delete their pidfiles when they exit.
105 # Function that sends a SIGHUP to the daemon/service
109 # If the daemon can reload its configuration without
110 # restarting (for example, when it is sent a SIGHUP),
111 # then implement that here.
113 start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name $NAME
119 [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
122 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
123 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
127 [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
130 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
131 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
135 status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
137 #reload|force-reload)
139 # If do_reload() is not implemented then leave this commented out
140 # and leave 'force-reload' as an alias for 'restart'.
142 #log_daemon_msg "Reloading $DESC" "$NAME"
146 restart|force-reload)
148 # If the "reload" option is implemented then remove the
149 # 'force-reload' alias
151 log_daemon_msg "Restarting $DESC" "$NAME"
158 1) log_end_msg 1 ;; # Old process is still running
159 *) log_end_msg 1 ;; # Failed to start
169 #echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
170 echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2