blob: 298c2b22c353eb37357ba1386b6e64ad6210792e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
#!/bin/bash
#
# 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"
function puppet_start {
sleep `echo $RANDOM/2000*60 | bc`
$INIT start
}
function puppet_restart {
$INIT stop
puppet_start
}
if [ "$1" == "restart" ]; then
puppet_restart
elif [ ! -f "$PID" ]; then
puppet_start
else
running="$(ps $(cat $PID) &> /dev/null)"
if [ "$?" != "0" ]; then
puppet_start
fi
fi
|