Sophie

Sophie

distrib > Mandriva > 2010.2 > i586 > media > contrib-release-src > by-pkgid > 5eeb4b528dfe82a7b654fbbc1c8f0a6e > files > 4

cfengine3-3.0.4-2mdv2010.1.src.rpm

#!/bin/sh
#
# chkconfig: 345 55 45
# description: Starts the cf-monitord daemon

### BEGIN INIT INFO
# Provides: cf-monitord
# Required-Start: $network
# Required-Stop: $network
# Default-Start: 345
# Short-Description: Starts the cf-monitord daemon
# Description: This startup script launches the cf-monitord daemon
### END INIT INFO

# Local variables
NAME=cf-monitord
BINARY=/usr/sbin/$NAME
PROCESS=$NAME
LOCKFILE=/var/lock/subsys/$NAME

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

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

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

# load service configuration
[ -f /etc/sysconfig/cfengine ] && . /etc/sysconfig/cfengine

start() {
    # Check if it is already running
    if [ ! -f $LOCKFILE ]; then
	echo -n "Starting $NAME:"
	daemon $BINARY
	RETVAL=$?
	[ $RETVAL -eq 0 ] && touch $LOCKFILE
	echo
    fi
}

stop() {
    echo -n "Stopping $NAME:"
    killproc $PROCESS
    RETVAL=$?
    [ $RETVAL -eq 0 ] && rm -f $LOCKFILE
    echo
}

restart() {
    stop
    start
}

RETVAL=0

case "$1" in
    start)
	start
	;;
    stop)
	stop
	;;
    restart|reload)
	restart
	;;
    condrestart|condreload)
	if [ -f $LOCKFILE ]; then
	    restart
	fi
	;;
    status)
	status $PROCESS
	;;
    *)
	echo "Usage: $0 {start|stop|restart|reload|condrestart|condreload|status}"
	RETVAL=1
	;;
esac

exit $RETVAL