bash script execute commands after ssh -


I am trying to execute some commands through my first script but it is not working.

  #! / Bin / bash #connect Join the server "Connecting to server ..." ssh -t root @ ip '#switch Deploying user to deploy #Smart path echo "Path switching" CD / var / www / Deploys / bin / app / config #run hypothesis script echo "run deployment script" / usr / local / bin / cap -s env = prod deploy #restart apache sudo / bin / systemctl restart httpd.service bash -l ' 

What's going on? I am successfully connected to the server, the user changes and then I do not see anything. When I press ctrl + c in the terminal, some output should be executed with the command, but there are some errors.

I do not see everything happening in the terminal script? Am I doing it wrong?

BTW: When I try to connect myself manually and run commands, then everything is working well.

Using CentOS 7.

The way to log in through ssh and removing a set of commands is

  ssh user @ ip  

here EOF acts as the delimiter for the command list

The script can be modified

  ssh -t root ip  
< P> command excecutes and then the connection will close

s env = prod deploy #restart apache sudo / bin / systemctl restart httpd.service bash -l EOF <

Comments

Popular posts from this blog

winforms - C# Form - Property Change -

java - Messages from .properties file do not display UTF-8 characters -

javascript - amcharts makechart not working -