Subversion Repositories

?revision_form?Rev ?revision_input??revision_submit??revision_endform?

Rev 71 | Rev 116 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 71 Rev 73
Line 13... Line 13...
13
### END INIT INFO
13
### END INIT INFO
14
14
15
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
15
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
16
FRONTEND_DAEMON=/usr/sbin/prayer
16
FRONTEND_DAEMON=/usr/sbin/prayer
17
SESSION_DAEMON=/usr/sbin/prayer-session
17
SESSION_DAEMON=/usr/sbin/prayer-session
18
FRONTEND_PIDFILE=/var/run/prayer/prayer.pid
18
VAR_PREFIX=/var/run/prayer
19
SESSION_PIDFILE=/var/run/prayer/prayer-session.pid
19
PRAYER_USER=prayer
20
DESC="webmail server"
20
DESC="webmail server"
21
21
22
test -x $FRONTEND_DAEMON -a -x $SESSION_DAEMON || exit 0
22
test -x $FRONTEND_DAEMON -a -x $SESSION_DAEMON || exit 0
23
23
24
. /lib/lsb/init-functions
24
. /lib/lsb/init-functions
Line 28... Line 28...
28
# Include prayer defaults if available
28
# Include prayer defaults if available
29
if [ -f /etc/default/prayer ] ; then
29
if [ -f /etc/default/prayer ] ; then
30
	. /etc/default/prayer
30
	. /etc/default/prayer
31
fi
31
fi
32
32
-
 
33
FRONTEND_PIDFILE="$VAR_PREFIX/prayer.pid"
-
 
34
SESSION_PIDFILE="$VAR_PREFIX/prayer-session.pid"
-
 
35
33
set +e
36
set +e
34
37
35
start() {
38
start() {
36
    if [ "$ENABLED" = "0" ]; then
39
    if [ "$ENABLED" = "0" ]; then
37
	echo "Prayer is disabled. Please set ENABLED=1 in /etc/default/prayer"
40
	echo "Prayer is disabled. Please set ENABLED=1 in /etc/default/prayer"
38
	echo "after adapting /etc/prayer/prayer.cf to your needs."
41
	echo "after adapting /etc/prayer/prayer.cf to your needs."
39
	exit 0
42
	exit 0
40
    fi
43
    fi
41
44
42
    log_daemon_msg "Starting $DESC" "prayer"
45
    log_daemon_msg "Starting $DESC" "prayer"
43
    start-stop-daemon --start --pidfile $FRONTEND_PIDFILE \
46
    start-stop-daemon --start --pidfile "$FRONTEND_PIDFILE" \
44
	--exec $FRONTEND_DAEMON -- $DAEMON_OPTS
47
                      --exec "$FRONTEND_DAEMON" \
-
 
48
                      -- $DAEMON_OPTS --config-option "prayer_user=$PRAYER_USER" \
-
 
49
                                      --config-option "var_prefix=$VAR_PREFIX" \
-
 
50
                                      --config-option "pid_dir=$VAR_PREFIX"
45
    log_end_msg $?
51
    log_end_msg $?
46
}
52
}
47
53
48
stop() {
54
stop() {
49
    log_daemon_msg "Stopping $DESC" 
55
    log_daemon_msg "Stopping $DESC" 
50
    if [ -f "$SESSION_PIDFILE" ]; then
56
    if [ -f "$SESSION_PIDFILE" ]; then
51
	start-stop-daemon --stop --quiet --oknodo --pidfile $SESSION_PIDFILE
57
	start-stop-daemon --stop --quiet --oknodo --pidfile "$SESSION_PIDFILE"
52
	log_progress_msg "prayer-session"
58
	log_progress_msg "prayer-session"
53
    fi
59
    fi
54
    if [ -f "$FRONTEND_PIDFILE" ]; then
60
    if [ -f "$FRONTEND_PIDFILE" ]; then
55
	start-stop-daemon --stop --quiet --oknodo --pidfile $FRONTEND_PIDFILE
61
	start-stop-daemon --stop --quiet --oknodo --pidfile "$FRONTEND_PIDFILE"
56
	start-stop-daemon --stop --quiet --oknodo --exec $FRONTEND_DAEMON
62
	start-stop-daemon --stop --quiet --oknodo --exec "$FRONTEND_DAEMON"
57
	log_progress_msg "prayer"
63
	log_progress_msg "prayer"
58
    fi
64
    fi
59
    rm -f "$FRONTEND_PIDFILE" "$SESSION_PIDFILE"
65
    rm -f "$FRONTEND_PIDFILE" "$SESSION_PIDFILE"
60
    log_end_msg 0
66
    log_end_msg 0
61
}
67
}
62
68
63
case "$1" in
69
case "$1" in
64
  start)
70
  start)
-
 
71
	# Create /var/run/prayer with prayer as owner in case /var/run is a tmpfs.
-
 
72
	# If local admin 
-
 
73
	install -d -m 2750 -o "$PRAYER_USER" "$VAR_PREFIX"
65
	start
74
	start
66
	;;
75
	;;
67
76
68
  stop)
77
  stop)
69
	stop
78
	stop