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
56 if test -n "$WEBCIT_LANG" -a "$WEBCIT_LANG" != "UNLIMITED"; then
57 export LANG=$WEBCIT_LANG
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
81 if test ! -d $LOGDIR; then
86 if test "$1" -lt "0"; then
91 # 0 if daemon has been started
92 # 1 if daemon was already running
93 # 2 if daemon could not be started
94 if $DAEMON -D$PIDFILE.$1 \
95 -p$@ -t$LOGDIR/access.${1}.log $4; then
103 # Function that stops the daemon/service
107 for i in $PIDFILE.*; do if test -f $i; then
121 if test -n "$MODERN"; then
122 [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
124 echo "Starting $DESC" "$NAME"
127 if test -n "$WEBCIT_LISTEN_IP"; then
128 LISTEN="-i$WEBCIT_LISTEN_IP"
131 do_start $WEBCIT_HTTP_PORT $WEBCIT_CITADEL_IP $WEBCIT_CITADEL_PORT "" "$LISTEN" "$WEBCIT_APACHEFLAG"
132 do_start $WEBCIT_HTTPS_PORT $WEBCIT_CITADEL_IP $WEBCIT_CITADEL_PORT -s "$LISTEN" "$WEBCIT_APACHEFLAG"
134 if test -n "$MODERN"; then
136 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
137 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
142 if test -n "$MODERN"; then
143 [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
145 echo "Stopping $DESC" "$NAME"
148 if test -n "$MODERN"; then
150 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
151 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
155 restart|force-reload)
156 if test -n "$MODERN"; then
157 log_daemon_msg "Restarting $DESC" "$NAME"
159 echo "Restarting $DESC" "$NAME"
164 if test -n "$MODERN"; then
167 do_start $WEBCIT_HTTP_PORT $WEBCIT_CITADEL_IP $WEBCIT_CITADEL_PORT "" "$WEBCIT_APACHEFLAG"
168 do_start $WEBCIT_HTTPS_PORT $WEBCIT_CITADEL_IP $WEBCIT_CITADEL_PORT -s "$WEBCIT_APACHEFLAG"
171 1) log_end_msg 1 ;; # Old process is still running
172 *) log_end_msg 1 ;; # Failed to start
181 do_start $WEBCIT_HTTP_PORT $WEBCIT_CITADEL_IP $WEBCIT_CITADEL_PORT "" "$WEBCIT_APACHEFLAG"
182 do_start $WEBCIT_HTTPS_PORT $WEBCIT_CITADEL_IP $WEBCIT_CITADEL_PORT -s "$WEBCIT_APACHEFLAG"
186 echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2