summaryrefslogtreecommitdiff
path: root/files/cluster/init.d/puppetmaster.CentOS
diff options
context:
space:
mode:
Diffstat (limited to 'files/cluster/init.d/puppetmaster.CentOS')
-rwxr-xr-xfiles/cluster/init.d/puppetmaster.CentOS108
1 files changed, 108 insertions, 0 deletions
diff --git a/files/cluster/init.d/puppetmaster.CentOS b/files/cluster/init.d/puppetmaster.CentOS
new file mode 100755
index 0000000..0cb5ef9
--- /dev/null
+++ b/files/cluster/init.d/puppetmaster.CentOS
@@ -0,0 +1,108 @@
+#!/bin/bash
+# puppetmaster This shell script enables the puppetmaster server.
+#
+# Author: Duane Griffin <d.griffin@psenterprise.com>
+#
+# chkconfig: - 65 45
+#
+# description: Server for the puppet system management tool.
+# processname: puppetmaster
+
+PATH=/usr/bin:/sbin:/bin:/usr/sbin
+export PATH
+
+lockfile=/var/lock/subsys/puppetmaster
+
+# Source function library.
+. /etc/rc.d/init.d/functions
+
+if [ -f /etc/sysconfig/puppetmaster ]; then
+ . /etc/sysconfig/puppetmaster
+fi
+
+PUPPETMASTER_OPTS=""
+[ -n "$PUPPETMASTER_MANIFEST" ] && PUPPETMASTER_OPTS="--manifest=${PUPPETMASTER_MANIFEST}"
+[ -n "$PUPPETMASTER_PORTS" ] && PUPPETMASTER_OPTS="$PUPPETMASTER_OPTS --servertype=mongrel"
+[ -n "$PUPPETMASTER_LOG" ] && PUPPETMASTER_OPTS="${PUPPETMASTER_OPTS} --logdest=${PUPPETMASTER_LOG}"
+PUPPETMASTER_OPTS="${PUPPETMASTER_OPTS} \
+ ${PUPPETMASTER_EXTRA_OPTS}"
+
+RETVAL=0
+
+prog=puppetmasterd
+PUPPETMASTER=/usr/sbin/$prog
+
+start() {
+ echo -n $"Starting puppetmaster: "
+
+ # Confirm the manifest exists
+ if [ -r $PUPPETMASTER_MANIFEST ]; then
+ if [ -n "$PUPPETMASTER_PORTS" ]; then
+ echo -n " (port "
+ for ((i=0; i<${#PUPPETMASTER_PORTS[@]}; i++)); do
+ echo -n "${PUPPETMASTER_PORTS[$i]}"
+ daemon $PUPPETMASTER $PUPPETMASTER_OPTS --masterport=${PUPPETMASTER_PORTS[$i]} --pidfile=puppetmaster.${PUPPETMASTER_PORTS[$i]}.pid
+ RETVAL=$? || $RETVAL
+ done
+ echo -n ")"
+ else
+ daemon $PUPPETMASTER $PUPPETMASTER_OPTS
+ RETVAL=$?
+ fi
+ else
+ failure $"Manifest does not exist: $PUPPETMASTER_MANIFEST"
+ echo
+ return 1
+ fi
+ [ $RETVAL -eq 0 ] && touch "$lockfile"
+ echo
+ return $RETVAL
+}
+
+stop() {
+ echo -n $"Stopping puppetmaster: "
+ if [ -n "$PUPPETMASTER_PORTS" ]; then
+ echo -n " (port "
+ for ((i=0; i<${#PUPPETMASTER_PORTS[@]}; i++)); do
+ echo -n "${PUPPETMASTER_PORTS[$i]}"
+ killproc -p puppetmaster.${PUPPETMASTER_PORTS[$i]}.pid $PUPPETMASTER
+ RETVAL=$? || $RETVAL
+ done
+ echo -n ")"
+ else
+ killproc $PUPPETMASTER
+ RETVAL=$?
+ fi
+ echo
+ [ $RETVAL -eq 0 ] && rm -f "$lockfile"
+ return $RETVAL
+}
+
+restart() {
+ stop
+ start
+}
+
+case "$1" in
+ start)
+ start
+ ;;
+ stop)
+ stop
+ ;;
+ restart|reload|force-reload)
+ restart
+ ;;
+ condrestart)
+ [ -f "$lockfile" ] && restart
+ ;;
+ status)
+ status $PUPPETMASTER
+ RETVAL=$?
+ ;;
+ *)
+ echo $"Usage: $0 {start|stop|status|restart|reload|force-reload|condrestart}"
+ exit 1
+esac
+
+exit $RETVAL