How do I keep a Perl script running on Unix after I log off?

CheeseConQueso picture CheeseConQueso · Mar 4, 2011 · Viewed 9.8k times · Source

I have a script that takes a lot of time to complete.

Instead of waiting for it to finish, I'd rather just log out and retrieve its output later on.

I've tried;

at -m -t 03030205 -f /path/to/./thescript.pl

nohup /path/to/./thescript.pl &

And I have also verified that the processes actually exist with ps and at -l depending on which scheduling syntax i used.

Both these processes die when I exit out of the shell. Is there a way to keep a script from terminating when I close the connection?

We have crons here and they are set up and are working properly, but I would like to use at or nohup for single-use scripts.

Is there something wrong with my syntax? Are there any other methods to producing the desired outcome?


EDIT:
I cannot use screen or disown - they aren't installed in my HP Unix setup and i am not in the position to install them either

Answer

Rob Agar picture Rob Agar · Mar 4, 2011

Use screen. It creates a terminal which keeps going when you log out. When you log back in you can switch back to it.