aboutsummaryrefslogtreecommitdiff
path: root/system/cfengine/rc.cfservd
diff options
context:
space:
mode:
authorMenno E. Duursma <druiloor@zonnet.nl>2010-05-11 22:26:30 +0200
committerDavid Somero <xgizzmo@slackbuilds.org>2010-05-11 22:26:30 +0200
commitccd4daa81cc9294c4d7beee7fc21f540b0463306 (patch)
tree52917e2ff28b4efc8d477ad57c63c445b65e0bfe /system/cfengine/rc.cfservd
parent588875632e3a4a12ee1748d882f8f4e9e9541291 (diff)
system/cfengine: Updated for version 2.2.8
Diffstat (limited to 'system/cfengine/rc.cfservd')
-rw-r--r--system/cfengine/rc.cfservd57
1 files changed, 57 insertions, 0 deletions
diff --git a/system/cfengine/rc.cfservd b/system/cfengine/rc.cfservd
new file mode 100644
index 0000000000000..68db3261ab9ec
--- /dev/null
+++ b/system/cfengine/rc.cfservd
@@ -0,0 +1,57 @@
+#!/bin/sh
+
+# start/stop/restart/reload cfservd
+
+# 'cfservd' looks for a configuration file cfservd.conf by default.
+
+# Note: this daemon doesn't actually need to run under the root account,
+# assuming an account named 'cfservd' exists, one way of configuring it
+# to use its own account would be to to run 'cfkey' and 'cfagent' ones
+# which creates the ~/.cfagent subdir then start the service with:
+# /bin/su - cfservd -c /usr/sbin/cfservd
+
+# Start cfservd:
+cfservd_start() {
+ if [ -x /usr/sbin/cfservd ]; then
+ # Make sure localhost keys exist first
+ if [ ! -f /var/cfengine/ppkeys/localhost.priv ]; then
+ /usr/sbin/cfkey
+ fi
+ echo "Starting Cfengine: /usr/sbin/cfservd"
+ /usr/sbin/cfservd
+ fi
+}
+
+# Stop cfservd:
+cfservd_stop() {
+ /bin/killall cfservd 2> /dev/null
+}
+
+# Restart cfservd:
+cfservd_restart() {
+ cfservd_stop
+ sleep 1
+ cfservd_start
+}
+
+# Reload cfservd:
+cfservd_reload() {
+ /bin/killall -HUP cfservd
+}
+
+case "$1" in
+'start')
+ cfservd_start
+ ;;
+'stop')
+ cfservd_stop
+ ;;
+'restart')
+ cfservd_restart
+ ;;
+'reload')
+ cfservd_reload
+ ;;
+*)
+ echo "usage $0 start|stop|restart|reload"
+esac