summaryrefslogtreecommitdiff
path: root/system/cfengine/rc.cfservd
diff options
context:
space:
mode:
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 0000000000..68db3261ab
--- /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