#!/bin/bash # # check if puppet is running # PID="/var/run/puppet/<%= puppet_agent_name %>.pid" INIT="/etc/init.d/puppet" function puppet_start { sleep `echo $RANDOM/2000*60 | bc` $INIT start } if [ ! -f "$PID" ]; then puppet_start else running="$(ps $(cat $PID) &> /dev/null)" if [ "$?" != "0" ]; then puppet_start fi fi