Ubuntu – Screen with ssh to overcome disconnection

bashssh

I have a script name.bash. I want to run it on the server serv@domaine with 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?

Best Answer

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:

ssh serv@domain
byobu
/path/to/script.whatever

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 byobu-enable.

Related Question