]> git.pld-linux.org Git - packages/cyrus-imapd.git/blobdiff - cyrus-sync.init
fix sievec/sieved being installed as libtool wrappers
[packages/cyrus-imapd.git] / cyrus-sync.init
index a52ab16bf84faa1b3d0ad818ba4f1f8d799a8fe7..191e26cb7074d3877d1d6cca4aa112145a604914 100644 (file)
@@ -6,6 +6,7 @@
 #
 # description: cyrus-imap replication service
 #
+# $Id$
 
 # Source function library
 . /etc/rc.d/init.d/functions
@@ -16,7 +17,7 @@
 # Check that networking is up.
 if is_yes "${NETWORKING}"; then
        if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
-               msg_network_down cyrus-sync
+               msg_network_down "Cyrus Replication"
                exit 1
        fi
 else
@@ -25,52 +26,76 @@ fi
 
 start() {
        # Check if the service is already running?
-       if [ ! -f /var/lock/subsys/<service> ]; then
-               msg_starting cyrus-sync
-               daemon /usr/lib/cyrus/sync_client -r &
-               if ps -C sync_client >/dev/null 2>&1; then
-                       RETVAL=$?
-                       [ $RETVAL -eq 0 ] && touch /var/lock/subsys/cyrus-sync
-                       ok
-               else
-                       fail
-               fi
+       if [ -f /var/lock/subsys/cyrus-sync ]; then
+               msg_already_running "Cyrus Replication"
+               return
+       fi
+
+       msg_starting "Cyrus Replication"
+       start-stop-daemon --start --quiet --exec /usr/lib/cyrus/sync_client -- -r
+       if ps -C sync_client >/dev/null 2>&1; then
+               RETVAL=$?
+               [ $RETVAL -eq 0 ] && touch /var/lock/subsys/cyrus-sync
+               ok
        else
-               msg_already_running cyrus-sync
+               fail
        fi
 }
 
 stop() {
-       if [ -f /var/lock/subsys/cyrus-sync ]; then
-               # Stop daemons.
-               msg_stopping cyrus-sync
-               killproc sync_client
-               killproc sync_client -TERM
+       if [ ! -f /var/lock/subsys/cyrus-sync ]; then
+               msg_not_running "Cyrus Replication"
+               return
+       fi
+
+       # Stop daemons.
+       msg_stopping "Cyrus Replication"
+       start-stop-daemon --stop --quiet --name sync_client
+       RETVAL=$?
+       if [ $RETVAL -eq 0 ]; then
                rm -f /var/lock/subsys/cyrus-sync
+               ok
        else
-               msg_not_running cyrus-sync
+               fail
        fi
 }
 
+condrestart() {
+       if [ ! -f /var/lock/subsys/cyrus-sync ]; then
+               msg_not_running "Cyrus Replication"
+               RETVAL=$1
+               return
+       fi
+
+       stop
+       start
+}
+
 RETVAL=0
 # See how we were called.
 case "$1" in
   start)
-       start
+       start
        ;;
   stop)
-       stop
+       stop
        ;;
-  restart|force-reload)
+  restart)
        stop
        start
        ;;
+  try-restart)
+       condrestart 0
+       ;;
+  force-reload)
+       condrestart 7
+       ;;
   status)
-       status <service>
+       status cyrus-sync sync_client
        RETVAL=$?
        ;;
   *)
-       msg_usage "$0 {start|stop|restart|force-reload|status}"
+       msg_usage "$0 {start|stop|restart|try-restart|force-reload|status}"
        exit 3
 esac
 
This page took 0.858162 seconds and 4 git commands to generate.