This one is a bit more complete. Requires PID support, and start-stop-daemon (i.e. it is for Debian, and I do not know if it is portable to other places; you can always get our start-stop-daemon, everything in Debian is free software).
You'll likely want to change DAEMON to master (we use cyrmaster in Debian), for example. The non-pidfile version I had before was so gross I wrote the pidfile support to get rid of it :P BTW, I also place the sockets under /var/run/cyrus, as per the FHS... -- "One disk to rule them all, One disk to find them. One disk to bring them all and in the darkness grind them. In the Land of Redmond where the shadows lie." -- The Silicon Valley Tarot Henrique Holschuh
#! /bin/sh # # cyrus21 /etc/init.d/ script for cyrus2 IMAPd # This file manages the Cyrus IMAPd master process. # # Copr. 2001 by Henrique de Moraes Holschuh <[EMAIL PROTECTED]> # Distributed under the GPL version 2 # # Version: $Id: cyrus21-common.init,v 1.1 2001/11/25 18:24:27 hmh Exp $ # # Overridable defaults CYRUS_VERBOSE= LISTENQUEUE= [ -r /etc/default/cyrus21 ] && . /etc/default/cyrus21 OPTIONS= [ "x${LISTENQUEUE}" != "x" ] && OPTIONS="-l ${LISTENQUEUE} ${OPTIONS}" PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin DAEMON=/usr/sbin/cyrmaster NAME=cyrmaster DESC="Cyrus IMAPd master server" test -x ${DAEMON} || exit 0 set -e START="--start --quiet --pidfile /var/run/${NAME}.pid --exec ${DAEMON} -- ${OPTIONS}" fixdirs () { [ -d /var/run/cyrus ] || { mkdir -p /var/run/cyrus chmod 750 /var/run/cyrus chown -h -R cyrus:mail /var/run/cyrus } } case "$1" in start) echo -n "Starting ${DESC}: " fixdirs if start-stop-daemon ${START} 2>&1 >/dev/null; then echo "$NAME." else if start-stop-daemon --test ${START} 2>&1 >/dev/null; then echo "(failed)." exit 1 else echo "${DAEMON} already running." exit 0 fi fi ;; stop) echo -n "Stopping $DESC: " if start-stop-daemon --stop --quiet --pidfile /var/run/$NAME.pid \ --quiet --startas $DAEMON 2>&1 >/dev/null; then echo "$NAME." else echo "(failed)." fi exit 0 ;; reload|force-reload) echo "Reloading $DESC configuration files." start-stop-daemon --stop --signal 1 --quiet \ --pidfile /var/run/$NAME.pid --exec $DAEMON 2>&1 >/dev/null ;; restart) $0 stop || true exec $0 start ;; *) N=/etc/init.d/$NAME echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2 exit 1 ;; esac exit 0
# Defaults for Cyrus IMAPd 2.1 initscript # sourced by /etc/init.d/cyrus21 # installed at /etc/default/cyrus21 by the maintainer scripts # $Id: cyrus21-common.default,v 1.1 2001/11/25 18:24:27 hmh Exp $ # # This is a POSIX shell fragment # # Set this to 1 or higher to enable debugging on cyrmaster #CYRUS_VERBOSE=1 # Socket listen queue backlog size # See listen(2). Default is 32, you may want to increase # this number if you have a very high connection rate #LISTENQUEUE=32