Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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?

share|improve this question
add comment

2 Answers 2

up vote 3 down vote accepted

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.

share|improve this answer
add comment

If you aren't doing anything interactive in that script, you can just set it to run using nohup, which will tell it to continue even if the ssh session ends. this would apply only to the one script rather than screen which essentially keeps your entire login session active.

The command would be:

nohup /path/to/name.bash &

The final ampersand sets the nohup process to run in the background.

More details on the nohup command: http://en.wikipedia.org/wiki/Nohup

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.