#!/bin/sh # # chkconfig: 2345 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 # 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 cmp -s $DB_CFG $DB_CFG_CACHE && CONVERT_NEEDED=0 || CONVERT_NEEDED=1 if [ $CONVERT_NEEDED -eq 1 ] ; then echo echo "db backends configured in this package do not match your system." echo echo "package configuration (in $DB_CFG):" cat $DB_CFG echo echo "your system configuration (in $DB_CFG_CACHE):" if [ -f $DB_CFG_CACHE ] ; then cat $DB_CFG_CACHE else echo "file not present" fi echo echo "BACKUP your spool directory and run the conversion utility" echo "/usr/lib/cyrus-imapd/cvt_cyrusdb_all." echo "If you are sure that the package configuration matches your system" echo "and this message is erroneus (for example if you just upgraded the" echo "rpm and there is no $DB_CFG_CACHE file in place" echo "but you are SURE that the configuration is correct), you can just copy" echo "$DB_CFG to $DB_CFG_CACHE and restart." RETVAL=1 return $RETVAL fi $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