Rev 3 | Rev 73 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3 | Rev 71 | ||
---|---|---|---|
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: |
5 | # Required-Start: |
6 | # Required-Stop: |
6 | # Required-Stop: |
7 | # Should-Start: $local_fs |
7 | # Should-Start: $local_fs |
8 | # Should-Stop: $local_fs |
8 | # Should-Stop: $local_fs |
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 | FRONTEND_PIDFILE=/var/run/prayer/prayer.pid |
18 | FRONTEND_PIDFILE=/var/run/prayer/prayer.pid |
19 | SESSION_PIDFILE=/var/run/prayer/prayer-session.pid |
19 | SESSION_PIDFILE=/var/run/prayer/prayer-session.pid |
20 | DESC="webmail server" |
20 | DESC="webmail server" |
21 | 21 | ||
22 | test -x $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 |
26 | ENABLED=0 |
27 | 27 | ||
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 | set +e |
33 | set +e |
34 | 34 | ||
35 | start() { |
35 | start() { |
36 | if [ "$ENABLED" = "0" ]; then |
36 | if [ "$ENABLED" = "0" ]; then |
37 | echo "Prayer is disabled. Please set ENABLED=1 in /etc/default/prayer" |
37 | echo "Prayer is disabled. Please set ENABLED=1 in /etc/default/prayer" |
38 | echo "after adapting /etc/prayer/prayer.cf to your needs." |
38 | echo "after adapting /etc/prayer/prayer.cf to your needs." |
39 | exit 0 |
39 | exit 0 |
40 | fi |
40 | fi |
41 | 41 | ||
42 | log_daemon_msg "Starting $DESC" "prayer" |
42 | log_daemon_msg "Starting $DESC" "prayer" |
43 | start-stop-daemon --start --pidfile $FRONTEND_PIDFILE \ |
43 | start-stop-daemon --start --pidfile $FRONTEND_PIDFILE \ |
44 | --exec $FRONTEND_DAEMON -- $DAEMON_OPTS |
44 | --exec $FRONTEND_DAEMON -- $DAEMON_OPTS |
45 | log_end_msg $? |
45 | log_end_msg $? |
46 | } |
46 | } |
47 | 47 | ||
48 | stop() { |
48 | stop() { |
49 | log_daemon_msg "Stopping $DESC" |
49 | log_daemon_msg "Stopping $DESC" |
50 | if [ -f "$SESSION_PIDFILE" ]; then |
50 | if [ -f "$SESSION_PIDFILE" ]; then |
51 | start-stop-daemon --stop --quiet --oknodo --pidfile $SESSION_PIDFILE |
51 | start-stop-daemon --stop --quiet --oknodo --pidfile $SESSION_PIDFILE |
52 | log_progress_msg "prayer-session" |
52 | log_progress_msg "prayer-session" |
53 | fi |
53 | fi |
54 | if [ -f "$FRONTEND_PIDFILE" ]; then |
54 | if [ -f "$FRONTEND_PIDFILE" ]; then |
55 | start-stop-daemon --stop --quiet --oknodo --pidfile $FRONTEND_PIDFILE |
55 | start-stop-daemon --stop --quiet --oknodo --pidfile $FRONTEND_PIDFILE |
56 | start-stop-daemon --stop --quiet --oknodo --exec $FRONTEND_DAEMON |
56 | start-stop-daemon --stop --quiet --oknodo --exec $FRONTEND_DAEMON |
57 | log_progress_msg "prayer" |
57 | log_progress_msg "prayer" |
58 | fi |
58 | fi |
59 | rm -f "$FRONTEND_PIDFILE" "$SESSION_PIDFILE" |
59 | rm -f "$FRONTEND_PIDFILE" "$SESSION_PIDFILE" |
60 | log_end_msg 0 |
60 | log_end_msg 0 |
61 | } |
61 | } |
62 | 62 | ||
63 | case "$1" in |
63 | case "$1" in |
64 | start) |
64 | start) |
65 | start |
65 | start |
66 | ;; |
66 | ;; |
67 | 67 | ||
68 | stop) |
68 | stop) |
69 | stop |
69 | stop |
70 | ;; |
70 | ;; |
71 | 71 | ||
72 | restart|force-reload) |
72 | restart|force-reload) |
73 | # |
73 | # |
74 | # If the "reload" option is implemented, move the "force-reload" |
74 | # If the "reload" option is implemented, move the "force-reload" |
75 | # option to the "reload" entry above. If not, "force-reload" is |
75 | # option to the "reload" entry above. If not, "force-reload" is |
76 | # just the same as "restart". |
76 | # just the same as "restart". |
77 | # |
77 | # |
78 | stop |
78 | stop |
- | 79 | sleep 1 |
|
79 | start |
80 | start |
80 | ;; |
81 | ;; |
81 | *) |
82 | *) |
82 | N=/etc/init.d/prayer |
83 | N=/etc/init.d/prayer |
83 | # echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2 |
84 | # echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2 |
84 | log_failure_msg "Usage: $N {start|stop|restart|force-reload}" >&2 |
85 | log_failure_msg "Usage: $N {start|stop|restart|force-reload}" >&2 |
85 | exit 1 |
86 | exit 1 |
86 | ;; |
87 | ;; |
87 | esac |
88 | esac |
88 | 89 | ||
89 | exit 0 |
90 | exit 0 |