Subversion Repositories

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

Rev 116 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
3 magnus 1
#!/bin/sh
2
#
3
### BEGIN INIT INFO
4
# Provides:          prayer
116 magnus 5
# Required-Start:    $local_fs $remote_fs
6
# Required-Stop:     $local_fs $remote_fs
7
# Should-Start:
8
# Should-Stop:
3 magnus 9
# Default-Start:     2 3 4 5
10
# Default-Stop:      0 1 6
11
# Short-Description: Prayer init script
12
# Description:       Init script for prayer services
13
### END INIT INFO
14
 
15
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
16
FRONTEND_DAEMON=/usr/sbin/prayer
17
SESSION_DAEMON=/usr/sbin/prayer-session
73 magnus 18
VAR_PREFIX=/var/run/prayer
19
PRAYER_USER=prayer
3 magnus 20
DESC="webmail server"
21
 
71 magnus 22
test -x $FRONTEND_DAEMON -a -x $SESSION_DAEMON || exit 0
3 magnus 23
 
24
. /lib/lsb/init-functions
25
 
26
# Include prayer defaults if available
27
if [ -f /etc/default/prayer ] ; then
28
	. /etc/default/prayer
29
fi
30
 
73 magnus 31
FRONTEND_PIDFILE="$VAR_PREFIX/prayer.pid"
32
SESSION_PIDFILE="$VAR_PREFIX/prayer-session.pid"
33
 
3 magnus 34
set +e
35
 
36
start() {
37
    log_daemon_msg "Starting $DESC" "prayer"
73 magnus 38
    start-stop-daemon --start --pidfile "$FRONTEND_PIDFILE" \
39
                      --exec "$FRONTEND_DAEMON" \
40
                      -- $DAEMON_OPTS --config-option "prayer_user=$PRAYER_USER" \
41
                                      --config-option "var_prefix=$VAR_PREFIX" \
42
                                      --config-option "pid_dir=$VAR_PREFIX"
3 magnus 43
    log_end_msg $?
44
}
45
 
46
stop() {
47
    log_daemon_msg "Stopping $DESC"
48
    if [ -f "$SESSION_PIDFILE" ]; then
73 magnus 49
	start-stop-daemon --stop --quiet --oknodo --pidfile "$SESSION_PIDFILE"
3 magnus 50
	log_progress_msg "prayer-session"
51
    fi
52
    if [ -f "$FRONTEND_PIDFILE" ]; then
73 magnus 53
	start-stop-daemon --stop --quiet --oknodo --pidfile "$FRONTEND_PIDFILE"
54
	start-stop-daemon --stop --quiet --oknodo --exec "$FRONTEND_DAEMON"
3 magnus 55
	log_progress_msg "prayer"
56
    fi
57
    rm -f "$FRONTEND_PIDFILE" "$SESSION_PIDFILE"
58
    log_end_msg 0
59
}
60
 
61
case "$1" in
62
  start)
73 magnus 63
	# Create /var/run/prayer with prayer as owner in case /var/run is a tmpfs.
64
	# If local admin
65
	install -d -m 2750 -o "$PRAYER_USER" "$VAR_PREFIX"
3 magnus 66
	start
67
	;;
68
 
69
  stop)
70
	stop
71
	;;
72
 
73
  restart|force-reload)
74
	#
75
	#	If the "reload" option is implemented, move the "force-reload"
76
	#	option to the "reload" entry above. If not, "force-reload" is
77
	#	just the same as "restart".
78
	#
79
	stop
71 magnus 80
	sleep 1
3 magnus 81
	start
82
	;;
83
  *)
84
	N=/etc/init.d/prayer
85
	# echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2
86
	log_failure_msg "Usage: $N {start|stop|restart|force-reload}" >&2
87
	exit 1
88
	;;
89
esac
90
 
91
exit 0