SysV init script for RedHat
Etienne Goyer
etienne.goyer at linuxquebec.com
Thu Apr 24 15:13:49 EDT 2003
Hello world,
I just wrote an init script for Cyrus imapd on RedHat (I tested 7.3).
To use it, just drop this script in /etc/init.d and do :
chkconfig --add cyrus-imapd
>From there on, Cyrus master will be started at runlevel 2, 3, 4 and 5.
You may also use the "service" command to start, stop, reload config,
check status, etc.
In the hope it will save somebody from reinventing the wheel ...
--
Etienne Goyer Linux Québec Technologies Inc.
http://www.LinuxQuebec.com etienne.goyer at linuxquebec.com
PGP Pub Key: http://www.LinuxQuebec.com/pubkeys/eg.key
Fingerprint: F569 0394 098A FC70 B572 5D20 3129 3D86 8FD5 C853
-------------- next part --------------
#!/bin/sh
#
# cyrus-imapd Cyrus IMAP daemon
#
# chkconfig: 2345 80 20
# description: Cyrus IMAP4rev1 daemon.
# processname: master
# config: /etc/imapd.conf
# config: /etc/cyrus.conf
# pidfile: /var/run/cyrus-master.pid
#
# Based on the postfix init script from RedHat 7.3
# Etienne Goyer, Linux Québec Technologies inc.
# April 24 2003
# Source function library.
. /etc/rc.d/init.d/functions
# Source networking configuration.
. /etc/sysconfig/network
# Source cyrus-imapd configuration.
if [ -f /etc/sysconfig/cyrus-imapd ] ; then
. /etc/sysconfig/cyrus-imapd
fi
# Default, override in /etc/sysconfig/cyrus-imapd
CYRUSMASTER="/usr/cyrus/bin/master"
# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0
[ -x /usr/cyrus/bin/master ] || exit 0
[ -f /etc/imapd.conf ] || exit 0
[ -f /etc/cyrus.conf ] || exit 0
RETVAL=0
prog="Cyrus master process"
start() {
# Start daemons.
echo -n "Starting $prog: "
daemon $CYRUSMASTER -d
RETVAL=$?
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/cyrus-imapd
echo
return $RETVAL
}
stop() {
# Stop daemons.
echo -n "Shutting down $prog: "
killproc $CYRUSMASTER
RETVAL=$?
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/cyrus-imapd
echo
return $RETVAL
}
reload() {
echo -n "Reloading $prog: "
kill -s HUP `/sbin/pidof $CYRUSMASTER`
RETVAL=$?
echo
return $RETVAL
}
restart() {
stop
start
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
reload)
reload
;;
status)
status $CYRUSMASTER
;;
condrestart)
[ -f /var/lock/subsys/cyrus-imapd ] && restart || :
;;
*)
echo "Usage: $0 {start|stop|restart|reload|status|condrestart}"
exit 1
esac
exit $?
More information about the Info-cyrus
mailing list