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
56 if test -z "$TZ"; then
57 if test -e /etc
/timezone
; then
58 TZ
=`cat /etc/timezone`
63 # Function that starts the daemon/service
70 #4: -f flag for apache
72 # for ubuntu: check our volatile dirs.
73 if test ! -d $RUNDIR; then
77 if test ! -d $LOGDIR; 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 -D$PIDFILE.
$1 \
91 -p$@
-t$LOGDIR/access.
${1}.log
$4; then
99 # Function that stops the daemon/service
103 for i
in $PIDFILE.
*; do if test -f $i; then
117 if test -n "$MODERN"; then
118 [ "$VERBOSE" != no
] && log_daemon_msg
"Starting $DESC" "$NAME"
120 echo "Starting $DESC" "$NAME"
123 if test -n "$WEBCIT_LISTEN_IP"; then
124 LISTEN
="-i$WEBCIT_LISTEN_IP"
127 do_start
$WEBCIT_HTTP_PORT $WEBCIT_CITADEL_IP $WEBCIT_CITADEL_PORT "" "$LISTEN" "$WEBCIT_APACHEFLAG"
128 do_start
$WEBCIT_HTTPS_PORT $WEBCIT_CITADEL_IP $WEBCIT_CITADEL_PORT -s "$LISTEN" "$WEBCIT_APACHEFLAG"
130 if test -n "$MODERN"; then
132 0|
1) [ "$VERBOSE" != no
] && log_end_msg
0 ;;
133 2) [ "$VERBOSE" != no
] && log_end_msg
1 ;;
138 if test -n "$MODERN"; then
139 [ "$VERBOSE" != no
] && log_daemon_msg
"Stopping $DESC" "$NAME"
141 echo "Stopping $DESC" "$NAME"
144 if test -n "$MODERN"; then
146 0|
1) [ "$VERBOSE" != no
] && log_end_msg
0 ;;
147 2) [ "$VERBOSE" != no
] && log_end_msg
1 ;;
151 restart|force-reload
)
152 if test -n "$MODERN"; then
153 log_daemon_msg
"Restarting $DESC" "$NAME"
155 echo "Restarting $DESC" "$NAME"
160 if test -n "$MODERN"; then
163 do_start
$WEBCIT_HTTP_PORT $WEBCIT_CITADEL_IP $WEBCIT_CITADEL_PORT "" "$WEBCIT_APACHEFLAG"
164 do_start
$WEBCIT_HTTPS_PORT $WEBCIT_CITADEL_IP $WEBCIT_CITADEL_PORT -s "$WEBCIT_APACHEFLAG"
167 1) log_end_msg
1 ;; # Old process is still running
168 *) log_end_msg
1 ;; # Failed to start
177 do_start
$WEBCIT_HTTP_PORT $WEBCIT_CITADEL_IP $WEBCIT_CITADEL_PORT "" "$WEBCIT_APACHEFLAG"
178 do_start
$WEBCIT_HTTPS_PORT $WEBCIT_CITADEL_IP $WEBCIT_CITADEL_PORT -s "$WEBCIT_APACHEFLAG"
182 echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2