I need to execute "monit restart haproxy" command after sudo su.
This is my script.sh
sudo su
monit restart haproxy.
Here if i will execute the script.sh file then it will hang and it is not executing the monit restart haproxy command.
Any idea.
Thanks in advanced.
Here comes some information about sudo su. You need to enter password for sudo or su command, here is some quote from link i posted that may be the source of your problem:
The
sudo
command is expecting you to enter a password which is why it will hang, you can use a pipe so that the password is passed to the command like this: