I'm trying to run google chrome inside docker containers. I have been able to successfully do so, however there have been instances where chrome would not run on some of the containers (mass creation of containers).
So I'm looking to run a while loop till the chrome process is found to be running. I've tried the following but with errors like "bash: [if: command not found"
var chrome_command = 'google-chrome --user-data-dir=/home/ubuntu/chrome-user-dir';
var cmd = '';
cmd += 'Xvfb :99 & ';
cmd += 'export DISPLAY=:99 & ';
cmd += 'x11vnc -rfbport 6001 -display :99 -bg -q & ';
cmd += 'while [if ps aux | grep "google-chrome"|grep -v grep > /dev/null]; do ' + chrome_command + '; sleep 1 ; done';
Could someone point out where I am going wrong! Thanks!
The last line should be:
-q
for the lastgrep
would suffice to see if there's matched lines in the input.!
to negate the result of list of commands.google-chrome
won't appears inps aux
.