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/
27 # Exit if the package is not installed
28 [ -x "$DAEMON" ] || exit 0
30 # Read configuration variable file if it is present
31 [ -r /etc/default/$NAME ] && . /etc/default/$NAME
35 # Load the VERBOSE setting and other rcS variables
36 if test -f /lib/init/vars.sh ; then
41 # Define LSB log_* functions.
42 # Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
43 if test -f /lib/lsb/init-functions; then
44 . /lib/lsb/init-functions
48 if test -f $DEFAULT; then
57 if test -z "$TZ"; then
58 if test -e /etc/timezone; then
59 TZ=`cat /etc/timezone`
64 # Function that starts the daemon/service
71 #4: -f flag for apache
73 # for ubuntu: check our volatile dirs.
74 if test ! -d $RUNDIR; then
78 if test ! -d $LOGDIR; then
83 if test "$1" -lt "0"; then
88 # 0 if daemon has been started
89 # 1 if daemon was already running
90 # 2 if daemon could not be started
91 if $DAEMON -D$PIDFILE.$1 \
92 -p$@ -t$LOGDIR/access.${1}.log $4; then
100 # Function that stops the daemon/service
104 for i in $PIDFILE.*; do if test -f $i; then
112 do_start $WEBCIT_HTTP_PORT $WEBCIT_CITADEL_IP $WEBCIT_CITADEL_PORT "" "$LISTEN" "$WEBCIT_APACHEFLAG"
113 do_start $WEBCIT_HTTPS_PORT $WEBCIT_CITADEL_IP $WEBCIT_CITADEL_PORT -s "$LISTEN" "$WEBCIT_APACHEFLAG"
119 if test -n "$MODERN"; then
120 [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
122 echo "Starting $DESC" "$NAME"
125 if test -n "$WEBCIT_LISTEN_IP"; then
126 LISTEN="-i$WEBCIT_LISTEN_IP"
129 do_start $WEBCIT_HTTP_PORT $WEBCIT_CITADEL_IP $WEBCIT_CITADEL_PORT "" "$LISTEN" "$WEBCIT_APACHEFLAG"
130 do_start $WEBCIT_HTTPS_PORT $WEBCIT_CITADEL_IP $WEBCIT_CITADEL_PORT -s "$LISTEN" "$WEBCIT_APACHEFLAG"
132 if test -n "$MODERN"; then
134 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
135 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
140 if test -n "$MODERN"; then
141 [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
143 echo "Stopping $DESC" "$NAME"
146 if test -n "$MODERN"; then
148 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
149 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
153 restart|force-reload)
154 if test -n "$MODERN"; then
155 log_daemon_msg "Restarting $DESC" "$NAME"
157 echo "Restarting $DESC" "$NAME"
162 if test -n "$MODERN"; then
165 do_start $WEBCIT_HTTP_PORT $WEBCIT_CITADEL_IP $WEBCIT_CITADEL_PORT "" "$WEBCIT_APACHEFLAG"
166 do_start $WEBCIT_HTTPS_PORT $WEBCIT_CITADEL_IP $WEBCIT_CITADEL_PORT -s "$WEBCIT_APACHEFLAG"
169 1) log_end_msg 1 ;; # Old process is still running
170 *) log_end_msg 1 ;; # Failed to start
179 do_start $WEBCIT_HTTP_PORT $WEBCIT_CITADEL_IP $WEBCIT_CITADEL_PORT "" "$WEBCIT_APACHEFLAG"
180 do_start $WEBCIT_HTTPS_PORT $WEBCIT_CITADEL_IP $WEBCIT_CITADEL_PORT -s "$WEBCIT_APACHEFLAG"
184 echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2