!/bin/bash
cd /home/pi/dockertest
sudo -S <<< Adminpassword docker-compose up -d --scale chrome=2 --scale firefox=0
I want to add a script to pm2 to start the SeleniumGrid. So I have created .sh file with above code and added to pm2 with
pm2 start '/home/user/dockertest/startGrid.sh' --name SeleniumGrid
Docker & Grid is up now, but in pm2 monit console, I see the command keeps iterating over and over. How to prevent this?
-S
in sudo
disables the lock of password piping (which could compromise the security of the system).
so you need to remove -S
from sudo
:
#!/bin/bash
cd /home/pi/dockertest
sudo <<< 'Adminpassword docker-compose up -d --scale chrome=2 --scale firefox=0'
and if you really want to disable the password pipe lock:
#!/bin/bash
cd /home/pi/dockertest
sudo -S bash -c 'Adminpassword docker-compose up -d --scale chrome=2 --scale firefox=0'
I Hope that helps.