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
57 # Function that starts the daemon/service
64 #4: -f flag for apache
66 # for ubuntu: check our volatile dirs.
67 if test ! -d $RUNDIR; then
71 if test ! -d $LOGDIR; then
76 if test "$1" -lt "0"; then
81 # 0 if daemon has been started
82 # 1 if daemon was already running
83 # 2 if daemon could not be started
84 if $DAEMON -D$PIDFILE.$1 \
85 -p$@ -t$LOGDIR/access.${1}.log $4; then
93 # Function that stops the daemon/service
97 for i in $PIDFILE.*; do if test -f $i; then
111 if test -n "$MODERN"; then
112 [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
114 echo "Starting $DESC" "$NAME"
117 do_start $WEBCIT_HTTP_PORT $WEBCIT_CITADEL_IP $WEBCIT_CITADEL_PORT "" "$WEBCIT_APACHEFLAG"
118 do_start $WEBCIT_HTTPS_PORT $WEBCIT_CITADEL_IP $WEBCIT_CITADEL_PORT -s "$WEBCIT_APACHEFLAG"
120 if test -n "$MODERN"; then
122 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
123 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
128 if test -n "$MODERN"; then
129 [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
131 echo "Stopping $DESC" "$NAME"
134 if test -n "$MODERN"; then
136 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
137 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
141 restart|force-reload)
142 if test -n "$MODERN"; then
143 log_daemon_msg "Restarting $DESC" "$NAME"
145 echo "Restarting $DESC" "$NAME"
150 if test -n "$MODERN"; then
156 1) log_end_msg 1 ;; # Old process is still running
157 *) log_end_msg 1 ;; # Failed to start
170 echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2