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: Wilfried Goesgens <citadel@outgesourced.org>
14 RUNDIR=/var/run/webcit
15 PATH=/sbin:/usr/sbin:/bin:/usr/bin
16 DESC="Citadel Groupware Webserver "
18 DAEMON=/usr/sbin/$NAME
20 PIDFILE=$RUNDIR/$NAME.pid
21 SCRIPTNAME=/etc/init.d/webcit
22 SENDCOMMAND=/usr/sbin/sendcommand
23 DEFAULT=/etc/default/webcit
24 LOGDIR=/var/log/webcit/
31 # Exit if the package is not installed
32 [ -x "$DAEMON" ] || exit 0
34 # Read configuration variable file if it is present
35 [ -r /etc/default/$NAME ] && . /etc/default/$NAME
39 # Load the VERBOSE setting and other rcS variables
40 if test -f /lib/init/vars.sh ; then
45 # Define LSB log_* functions.
46 # Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
47 if test -f /lib/lsb/init-functions; then
48 . /lib/lsb/init-functions
52 if test -f $DEFAULT; then
57 # Function that starts the daemon/service
65 # for ubuntu: check our volatile dirs.
66 if test ! -d $RUNDIR; then
70 if test ! -d $LOGDIR; then
77 if test "$1" -lt "0"; then
82 # 0 if daemon has been started
83 # 1 if daemon was already running
84 # 2 if daemon could not be started
85 if $DAEMON -D$PIDFILE.$1 \
86 -p$@ -t$LOGDIR/access.${1}.log ; then
91 # Add code here, if necessary, that waits for the process to be ready
92 # to handle requests from services started subsequently which depend
93 # on this one. As a last resort, sleep for some time.
97 # Function that stops the daemon/service
102 # 0 if daemon has been stopped
103 # 1 if daemon was already stopped
104 # 2 if daemon could not be stopped
105 # other if a failure occurred
107 for i in $PIDFILE.*; do if test -f $i; then
112 #while test -d /proc/`cat $PIDFILE`; do
113 # /usr/bin/printf '.'
117 #start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME
119 #[ "$RETVAL" = 2 ] && return 2
120 # Wait for children to finish too if this is a daemon that forks
121 # and if the daemon is only ever run from this initscript.
122 # If the above conditions are not satisfied then add some other code
123 # that waits for the process to drop all resources that could be
124 # needed by services started subsequently. A last resort is to
125 # sleep for some time.
126 #start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON
127 #[ "$?" = 2 ] && return 2
128 # Many daemons don't delete their pidfiles when they exit.
133 # Function that sends a SIGHUP to the daemon/service
137 # If the daemon can reload its configuration without
138 # restarting (for example, when it is sent a SIGHUP),
139 # then implement that here.
141 # start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name $NAME
149 if test -n "$MODERN"; then
150 [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
152 echo "Starting $DESC" "$NAME"
155 do_start $WEBCIT_HTTP_PORT $WEBCIT_CITADEL_IP $WEBCIT_CITADEL_PORT
156 do_start $WEBCIT_HTTPS_PORT $WEBCIT_CITADEL_IP $WEBCIT_CITADEL_PORT -s
158 if test -n "$MODERN"; then
160 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
161 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
166 if test -n "$MODERN"; then
167 [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
169 echo "Stopping $DESC" "$NAME"
172 if test -n "$MODERN"; then
174 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
175 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
179 #reload|force-reload)
181 # If do_reload() is not implemented then leave this commented out
182 # and leave 'force-reload' as an alias for 'restart'.
184 #log_daemon_msg "Reloading $DESC" "$NAME"
188 restart|force-reload)
190 # If the "reload" option is implemented then remove the
191 # 'force-reload' alias
193 if test -n "$MODERN"; then
194 log_daemon_msg "Restarting $DESC" "$NAME"
196 echo "Restarting $DESC" "$NAME"
201 if test -n "$MODERN"; then
207 1) log_end_msg 1 ;; # Old process is still running
208 *) log_end_msg 1 ;; # Failed to start
219 #echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
220 echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2