]> gitweb.fluxo.info Git - puppet-puppet.git/commitdiff
Enhancing puppet-check
authorSilvio Rhatto <rhatto@riseup.net>
Wed, 23 Feb 2011 13:58:30 +0000 (10:58 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Wed, 23 Feb 2011 13:58:30 +0000 (10:58 -0300)
files/cron.d/puppetd
manifests/puppetd.pp
templates/check-puppetd.sh.erb

index 3e356ae3e131bcb73d39f9b41f2746d7a2593c91..137fa6ecfb467674b575cd2c574e8dda16b6767b 100644 (file)
@@ -1,2 +1,2 @@
 # restart puppet once in a while and randomly delay the restart between 0 and 32 minutes -> splay puppetmaster hammering
-0 22 * * */2   root /bin/bash -c "sleep `echo $RANDOM/1000*60 | bc` &&  /etc/init.d/puppet restart" > /dev/null
+0 22 * * */2   root /usr/local/sbin/check-puppetd.sh restart > /dev/null
index f2c6680494b66955483cc8737f1a7d507ca516e4..8265b772b503985e051cc8f8a4ae479527c430f6 100644 (file)
@@ -67,7 +67,7 @@ class puppetd inherits puppet {
   }
 
   cron { "puppetd-check":
-    command  => "/usr/local/sbin/check-puppetd.sh > /dev/null 2>&1",
+    command  => "/usr/local/sbin/check-puppetd.sh > /dev/null",
     user     => root,
     hour     => "*/1",
     minute   => "0",
index 639a1d519333fde47e29dc5d640efb0b22a65541..80ea3f63b78e9c300967214cd5f515893a59058e 100644 (file)
@@ -3,6 +3,7 @@
 # check if puppet is running
 #
 
+PATH="$PATH:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin"
 PID="/var/run/puppet/<%= puppet_agent_name %>.pid"
 INIT="/etc/init.d/puppet"
 
@@ -11,7 +12,9 @@ function puppet_start {
   $INIT start
 }
 
-if [ ! -f "$PID" ]; then
+if [ "$1" == "restart" ]; then
+  puppet_restart
+elif [ ! -f "$PID" ]; then
   puppet_start
 else
   running="$(ps $(cat $PID) &> /dev/null)"