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
27 PIDFILE=$RUNDIR/$NAME.pid
28 SCRIPTNAME=/etc/init.d/webcit
29 SENDCOMMAND=/usr/sbin/sendcommand
30 DEFAULT=/etc/default/webcit
31 LOGDIR=/var/log/webcit/
38 # Exit if the package is not installed
39 [ -x "$DAEMON" ] || exit 0
41 # Read configuration variable file if it is present
42 [ -r /etc/default/$NAME ] && . /etc/default/$NAME
46 # Load the VERBOSE setting and other rcS variables
47 if test -f /lib/init/vars.sh ; then
52 # Define LSB log_* functions.
53 # Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
54 if test -f /lib/lsb/init-functions; then
55 . /lib/lsb/init-functions
59 if test -f $DEFAULT; then
64 # Function that starts the daemon/service
72 # for ubuntu: check our volatile dirs.
73 if test ! -d $RUNDIR; then
77 if test ! -d $LOGDIR; then
84 if test "$1" -lt "0"; then
89 # 0 if daemon has been started
90 # 1 if daemon was already running
91 # 2 if daemon could not be started
92 if $DAEMON -d$PIDFILE.$1 \
93 -p$@ -t$LOGDIR/access.${1}.log ; then
98 # Add code here, if necessary, that waits for the process to be ready
99 # to handle requests from services started subsequently which depend
100 # on this one. As a last resort, sleep for some time.
104 # Function that stops the daemon/service
109 # 0 if daemon has been stopped
110 # 1 if daemon was already stopped
111 # 2 if daemon could not be stopped
112 # other if a failure occurred
114 for i in $PIDFILE.*; do if test -f $i; then
119 #while test -d /proc/`cat $PIDFILE`; do
120 # /usr/bin/printf '.'
124 #start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME
126 #[ "$RETVAL" = 2 ] && return 2
127 # Wait for children to finish too if this is a daemon that forks
128 # and if the daemon is only ever run from this initscript.
129 # If the above conditions are not satisfied then add some other code
130 # that waits for the process to drop all resources that could be
131 # needed by services started subsequently. A last resort is to
132 # sleep for some time.
133 #start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON
134 #[ "$?" = 2 ] && return 2
135 # Many daemons don't delete their pidfiles when they exit.
140 # Function that sends a SIGHUP to the daemon/service
144 # If the daemon can reload its configuration without
145 # restarting (for example, when it is sent a SIGHUP),
146 # then implement that here.
148 # start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name $NAME
156 if test -n "$MODERN"; then
157 [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
159 echo "Starting $DESC" "$NAME"
162 do_start $WEBCIT_HTTP_PORT $WEBCIT_CITADEL_IP $WEBCIT_CITADEL_PORT
163 do_start $WEBCIT_HTTPS_PORT $WEBCIT_CITADEL_IP $WEBCIT_CITADEL_PORT -s
165 if test -n "$MODERN"; then
167 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
168 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
173 if test -n "$MODERN"; then
174 [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
176 echo "Stopping $DESC" "$NAME"
179 if test -n "$MODERN"; then
181 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
182 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
186 #reload|force-reload)
188 # If do_reload() is not implemented then leave this commented out
189 # and leave 'force-reload' as an alias for 'restart'.
191 #log_daemon_msg "Reloading $DESC" "$NAME"
195 restart|force-reload)
197 # If the "reload" option is implemented then remove the
198 # 'force-reload' alias
200 if test -n "$MODERN"; then
201 log_daemon_msg "Restarting $DESC" "$NAME"
203 echo "Restarting $DESC" "$NAME"
208 if test -n "$MODERN"; then
214 1) log_end_msg 1 ;; # Old process is still running
215 *) log_end_msg 1 ;; # Failed to start
226 #echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
227 echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2