avoid multi chef client run starts
Change-Id: Ie676e4200f2ce4574d53021b28b6c000641645ea Closes-Bug: 1398963
This commit is contained in:
parent
bc97a1b193
commit
f49134271e
@ -24,10 +24,19 @@
|
|||||||
cat << EOF > /etc/chef/chef_client_run.sh
|
cat << EOF > /etc/chef/chef_client_run.sh
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
touch /tmp/chef.log
|
touch /tmp/chef.log
|
||||||
|
PIDFILE=/tmp/chef_client_run.pid
|
||||||
|
if [ -f \\$PIDFILE ]; then
|
||||||
|
pid=\\$(cat \\$PIDFILE)
|
||||||
|
if [ -f /proc/\\$pid/exe ]; then
|
||||||
|
echo "there are chef_client_run.sh running with pid \\$pid" &>> /tmp/chef.log
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
echo \\$$ > \\$PIDFILE
|
||||||
while true; do
|
while true; do
|
||||||
echo "run chef-client on \`date\`" &>> /tmp/chef.log
|
echo "run chef-client on \`date\`" &>> /tmp/chef.log
|
||||||
clients=\\$(pgrep chef-client)
|
clients=\\$(pgrep chef-client)
|
||||||
if [ "\\$?" == "0" ]; then
|
if [[ "\\$?" == "0" ]]; then
|
||||||
echo "there are chef-clients '\\$clients' running" &>> /tmp/chef.log
|
echo "there are chef-clients '\\$clients' running" &>> /tmp/chef.log
|
||||||
break
|
break
|
||||||
else
|
else
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
#if $str($getVar('anamon_enabled','')) == "1"
|
#if $str($getVar('anamon_enabled','')) == "1"
|
||||||
#if $getVar("compass_server", "") != ""
|
#if $getVar("compass_server", "") != ""
|
||||||
wget -O /tmp/anamon "http://$compass_server:$http_port/cobbler/aux/anamon"
|
wget -O /tmp/anamon "http://$compass_server:$http_port/cobbler/aux/anamon"
|
||||||
python /tmp/anamon --name "$name" --server "$compass_server" --port "$http_port"
|
python /tmp/anamon --name "$name" --server "$compass_server" --port "$http_port"
|
||||||
#else
|
#else
|
||||||
wget -O /tmp/anamon "http://$server:$http_port/cobbler/aux/anamon"
|
wget -O /tmp/anamon "http://$server:$http_port/cobbler/aux/anamon"
|
||||||
python /tmp/anamon --name "$name" --server "$_server" --port "$http_port"
|
python /tmp/anamon --name "$name" --server "$server" --port "$http_port"
|
||||||
#end if
|
#end if
|
||||||
#end if
|
#end if
|
||||||
|
@ -23,10 +23,19 @@
|
|||||||
cat << EOF > /etc/chef/chef_client_run.sh
|
cat << EOF > /etc/chef/chef_client_run.sh
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
touch /tmp/chef.log
|
touch /tmp/chef.log
|
||||||
|
PIDFILE=/tmp/chef_client_run.pid
|
||||||
|
if [ -f \\$PIDFILE ]; then
|
||||||
|
pid=\\$(cat \\$PIDFILE)
|
||||||
|
if [ -f /proc/\\$pid/exe ]; then
|
||||||
|
echo "there are chef_client_run.sh running with pid \\$pid" &>> /tmp/chef.log
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
echo \\$$ > \\$PIDFILE
|
||||||
while true; do
|
while true; do
|
||||||
echo "run chef-client on \`date\`" &>> /tmp/chef.log
|
echo "run chef-client on \`date\`" &>> /tmp/chef.log
|
||||||
clients=\\$(pgrep chef-client)
|
clients=\\$(pgrep chef-client)
|
||||||
if [ "\\$?" == "0" ]; then
|
if [[ "\\$?" == "0" ]]; then
|
||||||
echo "there are chef-clients '\\$clients' running" &>> /tmp/chef.log
|
echo "there are chef-clients '\\$clients' running" &>> /tmp/chef.log
|
||||||
break
|
break
|
||||||
else
|
else
|
||||||
|
Loading…
x
Reference in New Issue
Block a user