4
# Required-Start: $remote_fs $syslog
5
# Required-Stop: $remote_fs $syslog
6
# Default-Start: 2 3 4 5
8
# Short-Description: control citadel server start at boot time
9
# Description: control citadel server start at boot time
11
# uncomment this to create coredumps as described in
12
# http://www.citadel.org/doku.php/faq:mastering_your_os:gdb#how.do.i.make.my.system.produce.core-files
15
# Author: Wilfried Goesgens <citadel@outgesourced.org>
17
RUNDIR=/var/run/citadel
18
PATH=/sbin:/usr/sbin:/bin:/usr/bin
19
DESC="Citadel Groupware "
21
DAEMON=/usr/sbin/$NAME
22
PIDFILE=$RUNDIR/citadel.pid
23
DAEMON_ARGS=" -d -x3 -lmail -t/dev/null"
24
SCRIPTNAME=/etc/init.d/citadel
25
SENDCOMMAND=/usr/sbin/sendcommand
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
40
# Define LSB log_* functions.
41
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
42
if test -f /lib/lsb/init-functions; then
43
. /lib/lsb/init-functions
48
# Function that starts the daemon/service
52
# check our volatile dirs.
53
if test ! -d $RUNDIR; then
58
# 0 if daemon has been started
59
# 1 if daemon was already running
60
# 2 if daemon could not be started
70
# Function that stops the daemon/service
74
if test -S $RUNDIR/citadel.socket; then
75
sendcommand "DOWN" || :
78
PID=`cat $PIDFILE 2>/dev/null || :`
79
if [ ! -z $PID ]; then
82
while test -S /var/run/citadel/citadel.socket -o -d /proc/$PID; do
86
if test "$count" = "10"; then
87
kill $PID >/dev/null 2>&1
89
if test "$count" = "20"; then
90
kill -9 $PID >/dev/null 2>&1
91
rm -rf /var/run/citadel/*
100
# Function that sends a SIGHUP to the daemon/service
104
# 0 if daemon could not be restarted
105
# 1 if daemon has been restarted
106
# other if a failure occurred
107
if $SENDCOMMAND "DOWN 1" 2>&1|grep '200 Restarting'>/dev/null ; then
115
if test -n "$MODERN"; then
116
[ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
118
echo "Starting $DESC" "$NAME"
122
if test -n "$MODERN"; then
124
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
125
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
130
if test -n "$MODERN"; then
131
[ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
133
echo "Stopping $DESC" "$NAME"
136
if test -n "$MODERN"; then
137
[ "$VERBOSE" != no ] && log_end_msg 0
145
if test -n "$MODERN"; then
146
log_daemon_msg "Restarting $DESC" "$NAME"
148
echo "Restarting $DESC" "$NAME"
153
if test -n "$MODERN"; then
167
status_of_proc "$DAEMON" $NAME
171
echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2