diff options
author | mh <mh@immerda.ch> | 2008-04-10 20:57:21 +0000 |
---|---|---|
committer | mh <mh@immerda.ch> | 2008-04-10 20:57:21 +0000 |
commit | 2858e8d4eb9de90e0ab5d03bcd468d00fa8b8b56 (patch) | |
tree | 63f3fedc230b060b07564ef7f46ef87abb38438e /files/cluster/init.d | |
parent | 8c692461a73bf3a5c01388ee489366423d757594 (diff) |
fixed some configs, changed to new puppetsetup
Diffstat (limited to 'files/cluster/init.d')
-rwxr-xr-x | files/cluster/init.d/puppetmaster.CentOS | 108 |
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 |