Friday, 19 July 2019

linux - How do I run a script in the background and leave it running when I log out?




Possible Duplicate:
Leave bash script running on remote terminal while not logged in?



I have a bash script that runs Gaussian, a chemical structure calculator, which spends a couple days toying with a molecule. It runs on a Linux box that I load the input files and said script on to, then I (am supposed to) run it, wait a while, hope the program didn't crash, and log back on to collect the result.


Somewhat of a *nx newbie, but I can't seem to figure out how to set the script running and disconnect, while letting it continue on.


./jobscript

appears to block until it's done, and if I disconnect it terminates


./jobscript &

doesn't block, I can see it running in top, so I thought it was OK, but on logging out it apparently killed the program.


How do I set the thing to run and stay running, even if I logout?



Answer



You want to use the program screen. Here is the man page for it, and here is a nice tutorial. It should do exactly what you want it to do - execute something in the background and be able to come back to it later.


No comments:

Post a Comment

How can I VLOOKUP in multiple Excel documents?

I am trying to VLOOKUP reference data with around 400 seperate Excel files. Is it possible to do this in a quick way rather than doing it m...