On Wed, 2002-05-22 at 11:19, Captain Zod wrote:
> Hi all,
> Does anyone have a sample rc startup file for cyrus-imapd? If not how do 
> you startup cyrus-imapd? I use master. The problem is that master does not 
> detach from the terminal! If I run it in the background and put it into a 
> startup script then I will not get the return status code!
> 
What I use on a RedHat system is attached. It could easily be adapted to
other flavors of Unixen.
-- 
=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
 Jim Levie                                  email:
[EMAIL PROTECTED]
 Dynetics Inc,  Huntsville, Al              Ph.    256.964.4337
 The opinions expressed above are just that...
#!/bin/bash
#
# cyrus         This shell script takes care of starting and stopping
#               Cyrus IMAP.
#
# chkconfig: 2345 79 31
# description: Cyrus IMAP is the client interface to email, which
#              POP3 and IMAP protocols as access to the Sieve filters.
# processname: master
# config: /etc/imapd.conf

# Source function library.
. /etc/init.d/functions

# Source networking configuration.
. /etc/sysconfig/network

# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0

[ -f /usr/cyrus/bin/master ] || exit 0

RETVAL=0
prog="cyrus-imap"
start() {
	# Start Daemon

	echo -n $"Starting $prog: "
	/usr/cyrus/bin/master &

	RETVAL=$?
	echo
	[ $RETVAL -eq 0 ] && touch /var/lock/subsys/cyrus-imap
	return $RETVAL
}

stop() {
	# Stop daemons.
	echo -n $"Shutting down $prog: "
	killproc master
	RETVAL=$?
	echo
	[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/cyrus-imap
	return $RETVAL
}

# See how we were called.
case "$1" in
  start)
	start
	;;
  stop)
	stop
	;;
  restart|reload)
	stop
	start
	RETVAL=$?
	;;
  condrestart)
	if [ -f /var/lock/subsys/cyrus-imap ]; then
	    stop
	    start
	    RETVAL=$?
	fi
	;;
  *)
	echo $"Usage: $0 {start|stop|restart|condrestart|status}"
	exit 1
esac

exit $RETVAL

Reply via email to