]>
Commit | Line | Data |
---|---|---|
5491f82f ER |
1 | #!/bin/sh |
2 | # | |
3 | # cyrus-sync cyrus-sync Cyrus replication service | |
4 | # | |
5 | # chkconfig: 345 85 15 | |
6 | # | |
7 | # description: cyrus-imap replication service | |
8 | # | |
6b97f3c1 | 9 | # $Id$ |
5491f82f ER |
10 | |
11 | # Source function library | |
12 | . /etc/rc.d/init.d/functions | |
13 | ||
14 | # Get network config | |
15 | . /etc/sysconfig/network | |
16 | ||
17 | # Check that networking is up. | |
18 | if is_yes "${NETWORKING}"; then | |
19 | if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then | |
6b97f3c1 | 20 | msg_network_down "Cyrus Replication" |
5491f82f ER |
21 | exit 1 |
22 | fi | |
23 | else | |
24 | exit 0 | |
25 | fi | |
26 | ||
27 | start() { | |
28 | # Check if the service is already running? | |
441027f8 | 29 | if [ -f /var/lock/subsys/cyrus-sync ]; then |
6b97f3c1 | 30 | msg_already_running "Cyrus Replication" |
441027f8 | 31 | return |
5491f82f | 32 | fi |
5491f82f | 33 | |
441027f8 ER |
34 | msg_starting "Cyrus Replication" |
35 | start-stop-daemon --start --quiet --exec /usr/lib/cyrus/sync_client -- -r | |
36 | if ps -C sync_client >/dev/null 2>&1; then | |
303928bd | 37 | RETVAL=$? |
441027f8 ER |
38 | [ $RETVAL -eq 0 ] && touch /var/lock/subsys/cyrus-sync |
39 | ok | |
5491f82f | 40 | else |
441027f8 ER |
41 | fail |
42 | fi | |
43 | } | |
44 | ||
45 | stop() { | |
46 | if [ ! -f /var/lock/subsys/cyrus-sync ]; then | |
6b97f3c1 | 47 | msg_not_running "Cyrus Replication" |
441027f8 ER |
48 | return |
49 | fi | |
50 | ||
51 | # Stop daemons. | |
52 | msg_stopping "Cyrus Replication" | |
53 | start-stop-daemon --stop --quiet --name sync_client | |
54 | RETVAL=$? | |
55 | if [ $RETVAL -eq 0 ]; then | |
56 | rm -f /var/lock/subsys/cyrus-sync | |
57 | ok | |
58 | else | |
59 | fail | |
5491f82f ER |
60 | fi |
61 | } | |
62 | ||
0b5c6cbe | 63 | condrestart() { |
441027f8 | 64 | if [ ! -f /var/lock/subsys/cyrus-sync ]; then |
6b97f3c1 | 65 | msg_not_running "Cyrus Replication" |
0b5c6cbe | 66 | RETVAL=$1 |
441027f8 | 67 | return |
0b5c6cbe | 68 | fi |
441027f8 ER |
69 | |
70 | stop | |
71 | start | |
0b5c6cbe ER |
72 | } |
73 | ||
5491f82f ER |
74 | RETVAL=0 |
75 | # See how we were called. | |
76 | case "$1" in | |
77 | start) | |
303928bd | 78 | start |
5491f82f ER |
79 | ;; |
80 | stop) | |
303928bd | 81 | stop |
5491f82f | 82 | ;; |
0b5c6cbe | 83 | restart) |
5491f82f ER |
84 | stop |
85 | start | |
86 | ;; | |
0b5c6cbe ER |
87 | try-restart) |
88 | condrestart 0 | |
89 | ;; | |
90 | force-reload) | |
91 | condrestart 7 | |
92 | ;; | |
5491f82f | 93 | status) |
6b97f3c1 | 94 | status cyrus-sync sync_client |
5491f82f ER |
95 | RETVAL=$? |
96 | ;; | |
97 | *) | |
0b5c6cbe | 98 | msg_usage "$0 {start|stop|restart|try-restart|force-reload|status}" |
5491f82f ER |
99 | exit 3 |
100 | esac | |
101 | ||
102 | exit $RETVAL |