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 DROP_TO_UID=`id -u nobody`
30 # Exit if the package is not installed
31 [ -x "$DAEMON" ] || exit 0
33 # Read configuration variable file if it is present
34 [ -r /etc/default/$NAME ] && . /etc/default/$NAME
38 # Load the VERBOSE setting and other rcS variables
39 if test -f /lib/init/vars.sh ; then
44 # Define LSB log_* functions.
45 # Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
46 if test -f /lib/lsb/init-functions; then
47 . /lib/lsb/init-functions
51 if test -f $DEFAULT; then
60 if test -z "$TZ"; then
61 if test -e /etc/timezone; then
62 TZ=`cat /etc/timezone`
67 # Function that starts the daemon/service
74 #4: -f flag for apache
76 # for ubuntu: check our volatile dirs.
77 if test ! -d $RUNDIR; then
82 if test "$1" -lt "0"; then
87 # 0 if daemon has been started
88 # 1 if daemon was already running
89 # 2 if daemon could not be started
90 if $DAEMON -u $DROP_TO_UID -D$PIDFILE.$1 \
99 # Function that stops the daemon/service
103 for i in $PIDFILE.*; do if test -f $i; then
111 do_start $WEBCIT_HTTP_PORT $WEBCIT_CITADEL_IP $WEBCIT_CITADEL_PORT "" "$LISTEN" "$WEBCIT_APACHEFLAG"
112 do_start $WEBCIT_HTTPS_PORT $WEBCIT_CITADEL_IP $WEBCIT_CITADEL_PORT -s "$LISTEN" "$WEBCIT_APACHEFLAG"
118 if test -n "$MODERN"; then
119 [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
121 echo "Starting $DESC" "$NAME"
124 if test -n "$WEBCIT_LISTEN_IP"; then
125 LISTEN="-i$WEBCIT_LISTEN_IP"
128 do_start $WEBCIT_HTTP_PORT $WEBCIT_CITADEL_IP $WEBCIT_CITADEL_PORT "" "$LISTEN" "$WEBCIT_APACHEFLAG"
129 do_start $WEBCIT_HTTPS_PORT $WEBCIT_CITADEL_IP $WEBCIT_CITADEL_PORT -s "$LISTEN" "$WEBCIT_APACHEFLAG"
131 if test -n "$MODERN"; then
133 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
134 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
139 if test -n "$MODERN"; then
140 [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
142 echo "Stopping $DESC" "$NAME"
145 if test -n "$MODERN"; then
147 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
148 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
152 restart|force-reload)
153 if test -n "$MODERN"; then
154 log_daemon_msg "Restarting $DESC" "$NAME"
156 echo "Restarting $DESC" "$NAME"
161 if test -n "$MODERN"; then
164 do_start $WEBCIT_HTTP_PORT $WEBCIT_CITADEL_IP $WEBCIT_CITADEL_PORT "" "$WEBCIT_APACHEFLAG"
165 do_start $WEBCIT_HTTPS_PORT $WEBCIT_CITADEL_IP $WEBCIT_CITADEL_PORT -s "$WEBCIT_APACHEFLAG"
168 1) log_end_msg 1 ;; # Old process is still running
169 *) log_end_msg 1 ;; # Failed to start
178 do_start $WEBCIT_HTTP_PORT $WEBCIT_CITADEL_IP $WEBCIT_CITADEL_PORT "" "$WEBCIT_APACHEFLAG"
179 do_start $WEBCIT_HTTPS_PORT $WEBCIT_CITADEL_IP $WEBCIT_CITADEL_PORT -s "$WEBCIT_APACHEFLAG"
183 echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2