[boot-script] add hack to be sure no salt-call is running.
authorPaul Tonelli <paul.tonelli@logilab.fr>
Tue, 26 Nov 2013 13:58:51 +0100
changeset 167 506d0fb93a6b
parent 166 785b21aef8c9
child 168 5a6f7425f820
[boot-script] add hack to be sure no salt-call is running. This is an ugly workaround. But until something better is found, this is necessary to make sure the program runs at boot in automatic mode (closes #149110)
others/rc.local
--- a/others/rc.local	Thu Jun 27 15:44:51 2013 +0200
+++ b/others/rc.local	Tue Nov 26 13:58:51 2013 +0100
@@ -18,9 +18,19 @@
 ## get updated code if necessary 
 for i in `seq 3`
 do
+    while [ `pgrep -c salt-call` -ne 0 ]
+    do
+        sleep 1
+    done
+    ## wait until salt-call is not running any longer
     salt-call --no-color state.highstate | tee -a /var/log/ami-creator.log > /dev/console 2>&1
 done
 
+while [ `pgrep -c salt-call` -ne 0 ]
+do
+    sleep 1
+done
+## wait until salt-call is not running any longer
 ## download, untar, resize and mount
 ## update modify image depending on variation.sls file
 salt-call --no-color state.sls ami_creator | tee -a /var/log/ami-creator.log > /dev/console 2>&1