Using nohup PDF Print E-mail
Written by Martin   
Monday, 15 September 2008 12:08

Nohup is a UNIX utility that should be available for any flavour of Unix - AIX, Solaris, BSD, Linux, ... It prevents programs from terminating when they receive the HUP (hangup) signal, thus is the ideal candidate for long running SQL commands over a slow or unreliable line.

Here's an example of using it. Assume you want to run script long_running_work.sql, then you'd use this command:

$> nohup sqlplus user/password@database @/path/to/long_running_work.sql &
[1] 13624
$ Sending output to nohup.out

This goes to the regular background job, allowing you to query it:

$ jobs
[1] + Running nohup sqlplus user/password@database @/path/to/long_running_work.sql &

When you next try to exit your session, you'll be notified about the running jobs (but you can exit anyway since they'll continue happily in the background.

$ exit
You have running jobs

Note that you don't have to put quotes around your command you want to run!

This has been tested on Solaris 9 and 8 but I assume it'll work that way on any Linux. If you can, you should use screen though, which is a lot more flexible but I appreciate that it's not readily available on Solaris...

Last Updated on Monday, 15 September 2008 12:11


Powered by Joomla!. Designed by: enterprise hosting solutions joomla hosting Valid XHTML and CSS.