I have a script
name.bash. I want to run it on the server
ssh but I'm afraid to run it directly and close my
shell and stop execution.
I read that i can run my bash on the server with
screen to overcome these problem. What are the commands I would use please?
If you have a modern version of ubuntu on the server, then you can use byobu, which is a more updated version of screen.
From your local:
Then if your session drops (or you just close the terminal), you can reconnect with the ssh command and be right back where you were.
You can also set byobu to always be running, which is what I do, by typing
If you aren't doing anything interactive in that script, you can just set it to run using
The command would be:
The final ampersand sets the nohup process to run in the background.
More details on the nohup command: http://en.wikipedia.org/wiki/Nohup