On Sun, 2002-10-06 at 15:35, Felix Cuello wrote: > Do you have a script to start and stop cyrus to put in /etc/rc.d./init.d, > a little bit "soft" than: I have the following thingie on Solaris (replace paths as appropriate):
--- START SCRIPT #!/bin/sh ECHO="/usr/local/bin/echo" GREP="/usr/bin/grep" AWK="/usr/bin/awk" PID=`ps -eaf | ${GREP} ".*/cyrus/.*/master" | ${GREP} -v grep | ${GREP} -v $$ | ${AWK} '{print $2}'` case $1 in start) $ECHO -n "Starting Cyrus Mail Server... " if [ ! "X" = "X${PID}" ]; then echo echo "The Cyrus Mail Server appears to be running with pid $PID" echo "If you want to restart it, please use $0 restart" exit 0 fi if /usr/cyrus/bin/master & then $ECHO " ok" else $ECHO " failed" fi # sleep for socket initialization sleep 1 ;; stop) $ECHO -n "Stopping Cyrus Mail Server... " if [ -z "$PID" ] then echo $ECHO " Cyrus Mail Server not running" elif kill -9 $PID then $ECHO " ok" else $ECHO " failed" fi pkill -9 imapd pkill -9 pop3d pkill -9 timsieved pkill -9 notifyd ;; restart) $0 stop && $0 start ;; reload) [ -n $PID ] && kill -1 $PID ;; *) $ECHO "Usage: $0 start|stop|reload|restart" ;; esac