3 # Provides: cacert-gigi-signer
4 # Required-Start: $local_fs $network $remote_fs $syslog postgresql
5 # Required-Stop: $local_fs $network $remote_fs $syslog postgresql
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: unknown <software@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-gigi-signer"
21 NAME=cacert-gigi-signer
23 DAEMON_ARGS="-cp /usr/share/java/postgresql-jdbc4.jar:/usr/share/java/gigi.jar org.cacert.gigi.util.SimpleSigner"
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
34 # Load the VERBOSE setting and other rcS variables
37 # Define LSB log_* functions.
38 # Depend on lsb-base (>= 3.2-14) to ensure that this file is present
39 # and status_of_proc is working.
40 . /lib/lsb/init-functions
43 # Function that starts the daemon/service
47 if [ ! -f /var/lib/cacert-gigi/config/gigi.properties ]; then
48 echo Missing signer-configfile
52 # 0 if daemon has been started
53 # 1 if daemon was already running
54 # 2 if daemon could not be started
55 start-stop-daemon --start --quiet --pidfile $PIDFILE -d $DIR --startas $DAEMON --test > /dev/null \
57 start-stop-daemon -b --start --quiet --pidfile $PIDFILE --make-pidfile -d $DIR --startas $DAEMON -- \
60 # The above code will not work for interpreted scripts, use the next
61 # six lines below instead (Ref: #643337, start-stop-daemon(8) )
62 #start-stop-daemon --start --quiet --pidfile $PIDFILE --startas $DAEMON \
63 # --name $NAME --test > /dev/null \
65 #start-stop-daemon -b --start --quiet --pidfile $PIDFILE --startas $DAEMON \
66 # --name $NAME -- $DAEMON_ARGS \
69 # Add code here, if necessary, that waits for the process to be ready
70 # to handle requests from services started subsequently which depend
71 # on this one. As a last resort, sleep for some time.
75 # Function that stops the daemon/service
80 # 0 if daemon has been stopped
81 # 1 if daemon was already stopped
82 # 2 if daemon could not be stopped
83 # other if a failure occurred
84 start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE
86 [ "$RETVAL" = 2 ] && return 2
87 # Wait for children to finish too if this is a daemon that forks
88 # and if the daemon is only ever run from this initscript.
89 # If the above conditions are not satisfied then add some other code
90 # that waits for the process to drop all resources that could be
91 # needed by services started subsequently. A last resort is to
92 # sleep for some time.
93 start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --pidfile $PIDFILE
94 [ "$?" = 2 ] && return 2
95 # Many daemons don't delete their pidfiles when they exit.
101 # Function that sends a SIGHUP to the daemon/service
105 # If the daemon can reload its configuration without
106 # restarting (for example, when it is sent a SIGHUP),
107 # then implement that here.
109 start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name $NAME
115 [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
118 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
119 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
123 [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
126 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
127 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
131 status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
133 #reload|force-reload)
135 # If do_reload() is not implemented then leave this commented out
136 # and leave 'force-reload' as an alias for 'restart'.
138 #log_daemon_msg "Reloading $DESC" "$NAME"
142 restart|force-reload)
144 # If the "reload" option is implemented then remove the
145 # 'force-reload' alias
147 log_daemon_msg "Restarting $DESC" "$NAME"
154 1) log_end_msg 1 ;; # Old process is still running
155 *) log_end_msg 1 ;; # Failed to start
165 #echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
166 echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2