#!/bin/sh # # chkconfig: 345 65 35 # description: The Cyrus IMAPD master serves as a master process for the Cyrus \ # IMAP and POP servers. # config: /etc/cyrus.conf # config: /etc/imapd.conf # Author: Simon Matter <simix@datacomm.ch> # Version: 2002011900 # changed: 2002020200 chkconfig modified # 2002042500 rewrote start function # Modified for Mandrake by Luca Olivetti <luca@olivetti.cjb.net> # 2003020400 using new -p -d options to start master # 2004011500 removed check for compiled in db # (now a configuration option) ### BEGIN INIT INFO # Provides: cyrus-imapd # Required-Start: $network $remote_fs # Required-Stop: $network $remote_fs # Default-Start: 3 4 5 # Short-Description: Cyrus IMAPD daemon # Description: The Cyrus IMAPD master serves as a master process for the Cyrus \ # IMAP and POP servers. ### END INIT INFO # Source function library if [ -f /etc/init.d/functions ]; then . /etc/init.d/functions elif [ -f /etc/rc.d/init.d/functions ]; then . /etc/rc.d/init.d/functions else exit 0 fi # Source networking configuration. . /etc/sysconfig/network # Check that networking is up. [ ${NETWORKING} = "no" ] && exit 0 # check if the config files are present [ -f /etc/cyrus.conf ] || exit 0 [ -f /etc/imapd.conf ] || exit 0 # This is our service name BASENAME=`basename $0` if [ -L $0 ]; then BASENAME=`find $0 -name $BASENAME -printf %l` BASENAME=`basename $BASENAME` fi # Source service configuration. if [ -f /etc/sysconfig/$BASENAME ]; then . /etc/sysconfig/$BASENAME else echo "$BASENAME: configfile /etc/sysconfig/$BASENAME does NOT exist !" exit 1 fi CYRUSMASTER=/usr/lib/cyrus-imapd/cyrus-master CYRUS_PROC_NAME=`basename $CYRUSMASTER` CYRUS_STARTUP_TIMEOUT=20 DB_CFG=/usr/share/cyrus-imapd/rpm/db.cfg DB_CFG_CACHE=/var/lib/imap/rpm/db.cfg.cache RETVAL=0 start() { echo -n $"Starting $BASENAME: " if [ ! `/sbin/pidof -s $CYRUSMASTER` ]; then $CYRUSMASTER $CYRUSOPTIONS -p /var/run/${CYRUS_PROC_NAME}.pid -d fi RETVAL=$? action "" [ $RETVAL -eq 0 ] [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$BASENAME \ || rm -f /var/run/${CYRUS_PROC_NAME}.pid return $RETVAL } stop() { echo -n $"Shutting down $BASENAME: " killproc $CYRUSMASTER RETVAL=$? [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$BASENAME echo return $RETVAL } restart() { stop start } reload() { echo -n $"Reloading cyrus.conf file: " killproc $CYRUSMASTER -HUP RETVAL=$? echo return $RETVAL } condrestart() { [ -e /var/lock/subsys/$BASENAME ] && restart || : } rhstatus() { status $CYRUSMASTER } case "$1" in start) start ;; stop) stop ;; restart) restart ;; reload) reload ;; condrestart) condrestart ;; status) rhstatus ;; *) echo $"Usage: $BASENAME {start|stop|restart|reload|condrestart|status}" RETVAL=1 esac exit $RETVAL