summaryrefslogtreecommitdiff
path: root/files/check-puppetd.sh
blob: 10d6bc1e692f96cc5f43b59fac4a548caaf210ac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/bin/bash
#
# check if puppet is running
#

PID="/var/run/puppet/agent.pid"
INIT="/etc/init.d/puppet"

if [ ! -f "$PID" ]; then
  $INIT start
else
  running="$(ps $(cat $PID) &> /dev/null)"
  if [ "$?" != "0" ]; then
    sleep `echo $RANDOM/2000*60 | bc`
    $INIT start
  fi
fi