Subversion Repositories

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

Rev 116 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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