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 # uncomment this to create coredumps as described in
14 # http://www.citadel.org/doku.php/faq:mastering_your_os:gdb#how.do.i.make.my.system.produce.core-files
17 # Author: Wilfried Goesgens <citadel@outgesourced.org>
18 RUNDIR=/var/run/webcit
19 PATH=/sbin:/usr/sbin:/bin:/usr/bin
20 DESC="Citadel Groupware Webserver "
22 DAEMON=/usr/sbin/$NAME
24 PIDFILE=$RUNDIR/$NAME.pid
25 SCRIPTNAME=/etc/init.d/webcit
26 SENDCOMMAND=/usr/sbin/sendcommand
27 DEFAULT=/etc/default/webcit
28 LOGDIR=/var/log/webcit/
29 DROP_TO_UID=`id -u nobody`
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
61 if test -z "$TZ"; then
62 if test -e /etc/timezone; then
63 TZ=`cat /etc/timezone`
68 # Function that starts the daemon/service
75 #4: -f flag for apache
77 # for ubuntu: check our volatile dirs.
78 if test ! -d $RUNDIR; then
82 if test ! -d $LOGDIR; then
87 if test "$1" -lt "0"; then
92 # 0 if daemon has been started
93 # 1 if daemon was already running
94 # 2 if daemon could not be started
95 if $DAEMON -u $DROP_TO_UID -D$PIDFILE.$1 \
96 -p$@ -t$LOGDIR/access.${1}.log $4; then
104 # Function that stops the daemon/service
108 for i in $PIDFILE.*; do if test -f $i; then
116 do_start $WEBCIT_HTTP_PORT $WEBCIT_CITADEL_IP $WEBCIT_CITADEL_PORT "" "$LISTEN" "$WEBCIT_APACHEFLAG"
117 do_start $WEBCIT_HTTPS_PORT $WEBCIT_CITADEL_IP $WEBCIT_CITADEL_PORT -s "$LISTEN" "$WEBCIT_APACHEFLAG"
123 if test -n "$MODERN"; then
124 [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
126 echo "Starting $DESC" "$NAME"
129 if test -n "$WEBCIT_LISTEN_IP"; then
130 LISTEN="-i$WEBCIT_LISTEN_IP"
133 do_start $WEBCIT_HTTP_PORT $WEBCIT_CITADEL_IP $WEBCIT_CITADEL_PORT "" "$LISTEN" "$WEBCIT_APACHEFLAG"
134 do_start $WEBCIT_HTTPS_PORT $WEBCIT_CITADEL_IP $WEBCIT_CITADEL_PORT -s "$LISTEN" "$WEBCIT_APACHEFLAG"
136 if test -n "$MODERN"; then
138 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
139 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
144 if test -n "$MODERN"; then
145 [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
147 echo "Stopping $DESC" "$NAME"
150 if test -n "$MODERN"; then
152 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
153 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
157 restart|force-reload)
158 if test -n "$MODERN"; then
159 log_daemon_msg "Restarting $DESC" "$NAME"
161 echo "Restarting $DESC" "$NAME"
166 if test -n "$MODERN"; then
169 do_start $WEBCIT_HTTP_PORT $WEBCIT_CITADEL_IP $WEBCIT_CITADEL_PORT "" "$WEBCIT_APACHEFLAG"
170 do_start $WEBCIT_HTTPS_PORT $WEBCIT_CITADEL_IP $WEBCIT_CITADEL_PORT -s "$WEBCIT_APACHEFLAG"
173 1) log_end_msg 1 ;; # Old process is still running
174 *) log_end_msg 1 ;; # Failed to start
183 do_start $WEBCIT_HTTP_PORT $WEBCIT_CITADEL_IP $WEBCIT_CITADEL_PORT "" "$WEBCIT_APACHEFLAG"
184 do_start $WEBCIT_HTTPS_PORT $WEBCIT_CITADEL_IP $WEBCIT_CITADEL_PORT -s "$WEBCIT_APACHEFLAG"
188 echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2