]> git.pld-linux.org Git - packages/cyrus-imapd.git/blob - cyrus-sync.init
- updated to 2.3.16
[packages/cyrus-imapd.git] / cyrus-sync.init
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 # $Id$
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
20                 msg_network_down "Cyrus Replication"
21                 exit 1
22         fi
23 else
24         exit 0
25 fi
26
27 start() {
28         # Check if the service is already running?
29         if [ ! -f /var/lock/subsys/cyrus-sync ]; then
30                 msg_starting "Cyrus Replication"
31                 start-stop-daemon --start --quiet --exec /usr/lib/cyrus/sync_client -- -r
32                 if ps -C sync_client >/dev/null 2>&1; then
33                         RETVAL=$?
34                         [ $RETVAL -eq 0 ] && touch /var/lock/subsys/cyrus-sync
35                         ok
36                 else
37                         fail
38                 fi
39         else
40                 msg_already_running "Cyrus Replication"
41         fi
42 }
43
44 stop() {
45         if [ -f /var/lock/subsys/cyrus-sync ]; then
46                 # Stop daemons.
47                 msg_stopping "Cyrus Replication"
48                 start-stop-daemon --stop --quiet --name sync_client
49                 RETVAL=$?
50                 if [ $RETVAL -eq 0 ]; then
51                         rm -f /var/lock/subsys/cyrus-sync
52                         ok
53                 else
54                         fail
55                 fi
56         else
57                 msg_not_running "Cyrus Replication"
58         fi
59 }
60
61 condrestart() {
62         if [ -f /var/lock/subsys/cyrus-sync ]; then
63                 stop
64                 start
65         else
66                 msg_not_running "Cyrus Replication"
67                 RETVAL=$1
68         fi
69 }
70
71 RETVAL=0
72 # See how we were called.
73 case "$1" in
74   start)
75         start
76         ;;
77   stop)
78         stop
79         ;;
80   restart)
81         stop
82         start
83         ;;
84   try-restart)
85         condrestart 0
86         ;;
87   force-reload)
88         condrestart 7
89         ;;
90   status)
91         status cyrus-sync sync_client
92         RETVAL=$?
93         ;;
94   *)
95         msg_usage "$0 {start|stop|restart|try-restart|force-reload|status}"
96         exit 3
97 esac
98
99 exit $RETVAL
This page took 0.449793 seconds and 3 git commands to generate.