Sophie

Sophie

distrib > Mandriva > 2010.2 > x86_64 > by-pkgid > 4f92f270ef3262fcc5bc39ee11e14a9f > files > 1

cfengine3-execd-3.0.4-2mdv2010.1.x86_64.rpm

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

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

# Local values
NAME=cf-execd
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
	gprintf "Starting %s:" "$NAME"
	daemon $BINARY
	RETVAL=$?
	[ $RETVAL -eq 0 ] && touch $LOCKFILE
	echo
    fi
}

stop() {
    gprintf "Stopping %s:" "$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
	;;
    *)
	gprintf "Usage: %s {start|stop|restart|reload|condrestart|condreload|status}\n" "$0"
	RETVAL=1
	;;
esac

exit $RETVAL