On Fri, Oct 30, 2009 at 03:38:34PM -0700, Suvayu Ali wrote:
Hi Patrick,
Patrick O'Callaghan wrote:
On Fri, 2009-10-30 at 08:02 -0700, Suvayu Ali wrote:
I often find nohup very unreliable. I have had jobs fail submitted with nohup. I was thinking of switching to using screen. Maybe you could give that a try?
Screen is not an option if you want to set up a long-running job and log out. In what way has nohup failed on you? It's one of the oldest commands in the Shell toolbox and I've never had a problem with it.
Note that it's often a good idea to run it thus:
nohup command > OUTPUT 2>&1 &
Whenever I have used nohup I have used it exactly the way you have mentioned. And many times I later found out my job had failed when I had logged out. Since then I have stopped using nohup and wanted to look into screen. Until I do that I just don't log out any more unless I am sure my job has finished. Maybe the unreliability I have experienced is due to the versions of nohup I use (what ever comes as default with Scientific Linux 4, thats way too old).
`screen' on the other hand runs all your jobs independent of your login shell, as a post later in the thread has pointed out. It runs on the remote machine, and manages the jobs you want to execute. So unless screen itself crashes its pretty much safe to say the job will complete successfully.
Hopefully this clears up any doubts for you. I should definitely find some time to get familiar with screen. :-\
poc
Many years ago (15 or more, likely more) I found a little program on (I think it was) comp.sources.unix or similar, named "detach". I still use it because it really, certainly detaches your program from your terminal. The docs say something like "once you've detached your program you can box up your terminal and mail it to Brazil and the program won't know or care." and it's true. as long as the machine continues to run, you can log out and in and out and in and do whatever else you wish and it won't disturb the program.
I can probably dig up the sources and email them to any of you who may wish to have it. I have no place to post it for downloading. and having just gone looking for it, I still have detach.c and Makefile but seem to have lost the documentation (which isn't critical).
Fred