#!/bin/sh # # cyrus-sync cyrus-sync Cyrus replication service # # chkconfig: 345 85 15 # # description: cyrus-imap replication service # # Source function library . /etc/rc.d/init.d/functions # Get network config . /etc/sysconfig/network # 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 exit 1 fi else exit 0 fi start() { # Check if the service is already running? if [ ! -f /var/lock/subsys/ ]; 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 else msg_already_running cyrus-sync fi } stop() { if [ -f /var/lock/subsys/cyrus-sync ]; then # Stop daemons. msg_stopping cyrus-sync killproc sync_client killproc sync_client -TERM rm -f /var/lock/subsys/cyrus-sync else msg_not_running cyrus-sync fi } RETVAL=0 # See how we were called. case "$1" in start) start ;; stop) stop ;; restart|force-reload) stop start ;; status) status RETVAL=$? ;; *) msg_usage "$0 {start|stop|restart|force-reload|status}" exit 3 esac exit $RETVAL