4 # Required-Start: $local_fs $remote_fs
5 # Required-Stop: $local_fs $remote_fs
6 # Default-Start: 2 3 4 5
8 # Short-Description: Example initscript
9 # Description: This file should be used to construct scripts to be
10 # placed in /etc/init.d.
13 # Author: Foo Bar <foobar@baz.org>
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 RUNDIR=/var/run/webcit
22 PATH=/sbin:/usr/sbin:/bin:/usr/bin
23 DESC="Citadel Groupware Webserver "
25 DAEMON=/usr/sbin/$NAME
26 CTDLSVC=/usr/lib/citadel-webcit/ctdlsvc
28 PIDFILE=$RUNDIR/$NAME.pid
29 SCRIPTNAME=/etc/init.d/webcit
30 SENDCOMMAND=/usr/sbin/sendcommand
31 DEFAULT=/etc/default/webcit
32 LOGDIR=/var/log/webcit/
34 # Exit if the package is not installed
35 [ -x "$DAEMON" ] || exit 0
37 # Read configuration variable file if it is present
38 [ -r /etc/default/$NAME ] && . /etc/default/$NAME
40 # Load the VERBOSE setting and other rcS variables
43 # Define LSB log_* functions.
44 # Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
45 . /lib/lsb/init-functions
47 if test -f $DEFAULT; then
52 # Function that starts the daemon/service
60 # for ubuntu: check our volatile dirs.
61 if test ! -d $RUNDIR; then
65 if test ! -d $LOGDIR; then
72 if test "$1" -lt "0"; then
77 # 0 if daemon has been started
78 # 1 if daemon was already running
79 # 2 if daemon could not be started
80 if $CTDLSVC $PIDFILE.$1 $DAEMON \
81 -p$@ -t$LOGDIR/access.${1}.log ; then
86 # Add code here, if necessary, that waits for the process to be ready
87 # to handle requests from services started subsequently which depend
88 # on this one. As a last resort, sleep for some time.
92 # Function that stops the daemon/service
97 # 0 if daemon has been stopped
98 # 1 if daemon was already stopped
99 # 2 if daemon could not be stopped
100 # other if a failure occurred
102 kill `cat $PIDFILE.*`
105 #while test -d /proc/`cat $PIDFILE`; do
106 # /usr/bin/printf '.'
110 #start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME
112 #[ "$RETVAL" = 2 ] && return 2
113 # Wait for children to finish too if this is a daemon that forks
114 # and if the daemon is only ever run from this initscript.
115 # If the above conditions are not satisfied then add some other code
116 # that waits for the process to drop all resources that could be
117 # needed by services started subsequently. A last resort is to
118 # sleep for some time.
119 #start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON
120 #[ "$?" = 2 ] && return 2
121 # Many daemons don't delete their pidfiles when they exit.
126 # Function that sends a SIGHUP to the daemon/service
130 # If the daemon can reload its configuration without
131 # restarting (for example, when it is sent a SIGHUP),
132 # then implement that here.
134 # start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name $NAME
142 [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
143 do_start $WEBCIT_HTTP_PORT $WEBCIT_CITADEL_IP $WEBCIT_CITADEL_PORT
144 do_start $WEBCIT_HTTPS_PORT $WEBCIT_CITADEL_IP $WEBCIT_CITADEL_PORT -s
146 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
147 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
151 [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
154 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
155 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
158 #reload|force-reload)
160 # If do_reload() is not implemented then leave this commented out
161 # and leave 'force-reload' as an alias for 'restart'.
163 #log_daemon_msg "Reloading $DESC" "$NAME"
167 restart|force-reload)
169 # If the "reload" option is implemented then remove the
170 # 'force-reload' alias
172 log_daemon_msg "Restarting $DESC" "$NAME"
179 1) log_end_msg 1 ;; # Old process is still running
180 *) log_end_msg 1 ;; # Failed to start
190 #echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
191 echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2