summaryrefslogtreecommitdiff
path: root/templates
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
parent1ce6003bf9710c1b75885a65b48fe8d638398e87 (diff)
downloadpuppet-puppet-51865fd8bfacc87e1ab85d560eb4f182a5d9113c.tar.gz
puppet-puppet-51865fd8bfacc87e1ab85d560eb4f182a5d9113c.tar.bz2
Enhancing check-puppetd.sh
Diffstat (limited to 'templates')
-rw-r--r--templates/check-puppetd.sh.erb21
-rw-r--r--templates/puppet-node.conf.erb2
2 files changed, 22 insertions, 1 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
diff --git a/templates/puppet-node.conf.erb b/templates/puppet-node.conf.erb
index 033c2e5..f8b1b32 100644
--- a/templates/puppet-node.conf.erb
+++ b/templates/puppet-node.conf.erb
@@ -6,7 +6,7 @@ rundir = /var/run/puppet
factpath = $vardir/lib/facter
pluginsync = true
-[<%= puppet_agent_section %>]
+[<%= puppet_agent_name %>]
vardir = /var/lib/puppet
ssldir = $vardir/ssl
server = puppet.<%= domain %>