IBM®
Skip to main content
    Country/region [select]      Terms of use
 
 
    
     Home      Products      Services & solutions      Support & downloads      My account     
 
developerworks > My developerWorks >  Dashboard > AIX > ... > AIXV53Howtos > AIXV53nohup
developerWorks
Log In   View a printable version of the current page.
Overview Connect Spaces Forums Wikis
AIXV53nohup
Added by OneSkyWalker, last edited by OneSkyWalker on Apr 27, 2009  (view change)
Labels: 
(None)

How to nohup a running process on AIX V5.3

This web page is meant to supplement, not replace, other documentation which has been published:

  • The nohup Command article in the System p and AIX Information Center.

As noted in the cited article, when the procedure below is used, output of the running process will not be re-directed to a nohup.out file. Unless output of the running process is already redirected to a file, any output produced by the process will be lost after the parent shell is closed.

To demonstrate the capability, while already logged in to a host, run 'telnet localhost' and login a second time. Then:

$ sleep 300             # Use Ctrl-Z here to temporarily stop the running process
^Z[1] + Stopped (SIGTSTP)        sleep 300
$ bg                    # Tell stopped process to resume running in the background
[1]     sleep 300&
$ jobs                  # List background jobs for current shell
[1] +  Running                 sleep 300
$ ps                    # List child processes of current shell
   PID    TTY  TIME CMD
 27038  pts/2  0:00 -ksh
 28368  pts/2  0:00 sleep 300
 28664  pts/2  0:00 ps
$ nohup -p 28368        # Tell the background process to ignore SIGHUP signals
$ exit                  # Log out (Ctrl-D can be used instead of exit)
There are running jobs.
$ exit                  # Ignore warning and log out again (Ctrl-D can be used instead of exit)
Connection closed.
$ ps -ef | grep sleep   # In shell from which 'telnet localhost' was run, show the job is still running
 pittman 24554 24890   1 20:51:55  pts/1  0:00 grep sleep
 pittman 28368     1   0 20:51:07      -  0:00 sleep 300
$

So is there some reason to run 'telnet localhost' as part of the demonstration above? (Aside from making it easy to demonstrate that the nohupped process is still running after exiting from parent shell?)

Yes, there is. Many levels of SSH have a bug which causes the shell to hang when exiting after nohupping a process in this way. (See a SourceForge bug report of a similar (and probably the same) bug that tclsh hangs during exit when logged on via OpenSSH.) If the demonstration above is attempted in an SSH login session to a system exposed to the SSH bug, the SSH session will hang after the second 'exit' above. The job will continue to run in the background, though.

The SSH hang after nohup occurs with OpenSSH at the 4.3.0.5301 level but does not occur with OpenSSH at the 5.0.0.5300 level.

The contents of this web page solely reflect the personal views of the authors and do not necessarily represent the views, positions, strategies or opinions of IBM or IBM management. Please use the Add Comment link at the bottom of the page to provide feedback. Note: Until you sign up and log in (using links in the upper right corner of this web page), you will not see the Add Comment link and you can not add a comment.


 
    About IBM Privacy Contact