#!/bin/sh # # chkconfig: 345 95 05 # description: Starts and stops the mprime program \ # used to calculate Mersenne primes. # 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 RETVAL=0 start() { status mprime > /dev/null RETVAL=$? if [ $RETVAL -gt 0 ]; then echo -n "Starting mprime: " daemon mprime RETVAL=$? echo [ $RETVAL -eq 0 ] && touch /var/lock/subsys/mprime || \ RETVAL=1 return $RETVAL fi } stop() { status mprime > /dev/null RETVAL=$? if [ $RETVAL -eq 0 ]; then echo -n "Shutting down mprime: " killproc mprime RETVAL=$? echo [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/mprime return $RETVAL fi } restart() { stop start } mdkstatus() { status mprime } case "$1" in start) start ;; stop) stop ;; restart) restart ;; status) mdkstatus ;; condrestart) [ -f /var/lock/subsys/mprime ] && restart || : ;; *) echo "Usage: $0 {start|stop|restart|condrestart|status}" exit 1 esac exit $?