0

I apologize if this question has been asked before, I wasn't able to find anything with my exact query.

I have a rather lengthy script that needs to be run on a remote computer, and it takes about 3 - 5 minutes to finish executing, usually.

I'm trying to figure out if I can go out tonight: ssh in through my phone, run the command that calls the script and then, even if my phone connection goes down, will the script finish executing on the remote computer?

Thanks!

user573117
  • 13
  • 2
  • If writing a script that shouldn't be interrupted then you might want to take a close look at [traps](http://tldp.org/LDP/Bash-Beginners-Guide/html/sect_12_02.html). You can define what the system will do when signals are sent. – Zoredache Apr 19 '13 at 22:48

1 Answers1

3

If your ssh connection dies your script will die, you can run it with the nohup command and it will run in the background and not die when your ssh connection dies.

nohup /path/to/script.sh

man page here

You could also use screen so you can detach from your session.

squareborg
  • 592
  • 3
  • 14