summaryrefslogtreecommitdiff
path: root/templates/check-puppetd.sh.erb
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2011-02-19 19:14:12 -0200
committerSilvio Rhatto <rhatto@riseup.net>2011-02-19 19:14:12 -0200
commit51865fd8bfacc87e1ab85d560eb4f182a5d9113c (patch)
treef05f5ca584fd8bdbd18309d095c2bca3be81e050 /templates/check-puppetd.sh.erb
parent1ce6003bf9710c1b75885a65b48fe8d638398e87 (diff)
downloadpuppet-puppet-51865fd8bfacc87e1ab85d560eb4f182a5d9113c.tar.gz
puppet-puppet-51865fd8bfacc87e1ab85d560eb4f182a5d9113c.tar.bz2
Enhancing check-puppetd.sh
Diffstat (limited to 'templates/check-puppetd.sh.erb')
-rw-r--r--templates/check-puppetd.sh.erb21
1 files changed, 21 insertions, 0 deletions
diff --git a/templates/check-puppetd.sh.erb b/templates/check-puppetd.sh.erb
new file mode 100644
index 0000000..639a1d5
--- /dev/null
+++ b/templates/check-puppetd.sh.erb
@@ -0,0 +1,21 @@
+#!/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