slackbuilds/system/cfengine/rc.cfengine

54 lines
962 B
Bash

#!/bin/sh
# start/stop/restart/reload cfexecd
# 'cfexecd' may be used to capture cfagent output and send it as
# mail when run. All control parameters are set in cfagent.conf.
# cfagent can in turn start any other service (e.g. cfenvd, cfservd)
# Start cfexecd:
cfexecd_start() {
if [ -x /usr/sbin/cfexecd ]; then
# Make sure localhost keys exist first
if [ ! -f /var/cfengine/ppkeys/localhost.priv ]; then
/usr/sbin/cfkey
fi
echo "Starting the CFEngine scheduler service: /usr/sbin/cfexecd"
/usr/sbin/cfexecd
fi
}
# Stop cfexecd:
cfexecd_stop() {
/bin/killall cfexecd 2> /dev/null
}
# Restart cfexecd:
cfexecd_restart() {
cfexecd_stop
sleep 1
cfexecd_start
}
# Reload cfexecd:
cfexecd_reload() {
/bin/killall -HUP cfexecd
}
case "$1" in
'start')
cfexecd_start
;;
'stop')
cfexecd_stop
;;
'restart')
cfexecd_restart
;;
'reload')
cfexecd_reload
;;
*)
echo "usage $0 start|stop|restart|reload"
esac