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
65 # for ubuntu: check our volatile dirs.
66 if test ! -d $RUNDIR; then
70 if test ! -d $LOGDIR; then
75 if test "$1" -lt "0"; then
80 # 0 if daemon has been started
81 # 1 if daemon was already running
82 # 2 if daemon could not be started
83 if $DAEMON -D$PIDFILE.$1 \
84 -p$@ -t$LOGDIR/access.${1}.log ; then
92 # Function that stops the daemon/service
96 for i in $PIDFILE.*; do if test -f $i; then
110 if test -n "$MODERN"; then
111 [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
113 echo "Starting $DESC" "$NAME"
116 do_start $WEBCIT_HTTP_PORT $WEBCIT_CITADEL_IP $WEBCIT_CITADEL_PORT
117 do_start $WEBCIT_HTTPS_PORT $WEBCIT_CITADEL_IP $WEBCIT_CITADEL_PORT -s
119 if test -n "$MODERN"; then
121 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
122 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
127 if test -n "$MODERN"; then
128 [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
130 echo "Stopping $DESC" "$NAME"
133 if test -n "$MODERN"; then
135 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
136 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
140 restart|force-reload)
141 if test -n "$MODERN"; then
142 log_daemon_msg "Restarting $DESC" "$NAME"
144 echo "Restarting $DESC" "$NAME"
149 if test -n "$MODERN"; then
155 1) log_end_msg 1 ;; # Old process is still running
156 *) log_end_msg 1 ;; # Failed to start
169 echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2