diff --git a/cobbler/snippets/kickstart_chef_run.sh b/cobbler/snippets/kickstart_chef_run.sh index aca8b4a..1652d01 100644 --- a/cobbler/snippets/kickstart_chef_run.sh +++ b/cobbler/snippets/kickstart_chef_run.sh @@ -24,10 +24,19 @@ cat << EOF > /etc/chef/chef_client_run.sh #!/bin/bash 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 echo "run chef-client on \`date\`" &>> /tmp/chef.log clients=\\$(pgrep chef-client) - if [ "\\$?" == "0" ]; then + if [[ "\\$?" == "0" ]]; then echo "there are chef-clients '\\$clients' running" &>> /tmp/chef.log break else diff --git a/cobbler/snippets/kickstart_pre_anamon b/cobbler/snippets/kickstart_pre_anamon index 179919c..70b8469 100644 --- a/cobbler/snippets/kickstart_pre_anamon +++ b/cobbler/snippets/kickstart_pre_anamon @@ -1,9 +1,9 @@ #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" python /tmp/anamon --name "$name" --server "$compass_server" --port "$http_port" -#else + #else wget -O /tmp/anamon "http://$server:$http_port/cobbler/aux/anamon" -python /tmp/anamon --name "$name" --server "$_server" --port "$http_port" -#end if +python /tmp/anamon --name "$name" --server "$server" --port "$http_port" + #end if #end if diff --git a/cobbler/snippets/preseed_chef_run.sh b/cobbler/snippets/preseed_chef_run.sh index 46699f9..be1d3b8 100644 --- a/cobbler/snippets/preseed_chef_run.sh +++ b/cobbler/snippets/preseed_chef_run.sh @@ -23,10 +23,19 @@ cat << EOF > /etc/chef/chef_client_run.sh #!/bin/bash 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 echo "run chef-client on \`date\`" &>> /tmp/chef.log clients=\\$(pgrep chef-client) - if [ "\\$?" == "0" ]; then + if [[ "\\$?" == "0" ]]; then echo "there are chef-clients '\\$clients' running" &>> /tmp/chef.log break else