]>
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 | # | |
9 | ||
10 | # Source function library | |
11 | . /etc/rc.d/init.d/functions | |
12 | ||
13 | # Get network config | |
14 | . /etc/sysconfig/network | |
15 | ||
16 | # Check that networking is up. | |
17 | if is_yes "${NETWORKING}"; then | |
18 | if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then | |
19 | msg_network_down cyrus-sync | |
20 | exit 1 | |
21 | fi | |
22 | else | |
23 | exit 0 | |
24 | fi | |
25 | ||
26 | start() { | |
27 | # Check if the service is already running? | |
28 | if [ ! -f /var/lock/subsys/<service> ]; then | |
29 | msg_starting cyrus-sync | |
30 | daemon /usr/lib/cyrus/sync_client -r & | |
31 | if ps -C sync_client >/dev/null 2>&1; then | |
32 | RETVAL=$? | |
33 | [ $RETVAL -eq 0 ] && touch /var/lock/subsys/cyrus-sync | |
34 | ok | |
35 | else | |
36 | fail | |
37 | fi | |
38 | else | |
39 | msg_already_running cyrus-sync | |
40 | fi | |
41 | } | |
42 | ||
43 | stop() { | |
44 | if [ -f /var/lock/subsys/cyrus-sync ]; then | |
45 | # Stop daemons. | |
46 | msg_stopping cyrus-sync | |
47 | killproc sync_client | |
48 | killproc sync_client -TERM | |
49 | rm -f /var/lock/subsys/cyrus-sync | |
50 | else | |
51 | msg_not_running cyrus-sync | |
52 | fi | |
53 | } | |
54 | ||
55 | RETVAL=0 | |
56 | # See how we were called. | |
57 | case "$1" in | |
58 | start) | |
59 | start | |
60 | ;; | |
61 | stop) | |
62 | stop | |
63 | ;; | |
64 | restart|force-reload) | |
65 | stop | |
66 | start | |
67 | ;; | |
68 | status) | |
69 | status <service> | |
70 | RETVAL=$? | |
71 | ;; | |
72 | *) | |
73 | msg_usage "$0 {start|stop|restart|force-reload|status}" | |
74 | exit 3 | |
75 | esac | |
76 | ||
77 | exit $RETVAL |