Sophie

Sophie

distrib > Mandriva > 2009.1 > x86_64 > media > main-testing > by-pkgid > 78fd2399aa77952d43cc3dfdf81c775b > files > 1

cfengine-cfservd-2.2.9-2mdv2009.1.x86_64.rpm

#!/bin/sh
#
# chkconfig: 345 55 45
# description: Starts the cfservd daemon

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

# Local values
NAME=cfservd
BINARY=/usr/sbin/$NAME
PROCESS=$NAME
LOCKFILE=/var/lock/subsys/$NAME
CFINPUTS=/etc/cfengine

# 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"
	export CFINPUTS
	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