When a user logs out of his session, the shell is killed. Hence any background processes started in the shell also gets killed. To avoid this and make background processes run even when the user logs out use nohup command.
When nohup (no hangup) command is prefixed with any command, the command continue to run even when the user who run that command logs out.
$ nohup compress comp.dmp &
$
The & indicates that the command runs in the background.
When you log out the session the parent is killed, in such situation the kernel assigns the orphan (child) to the system's init process (PID 1) the parent of all shells. Hence when the user logs out, init takes over the parentage of any process run with nohup.
If you run more than one command in a pipeline, then use the nohup command at the beginning of each command in the pipeline,
$ nohup grep 'ORA-' alert_prod.log & nohup sort &
Thanks
Monday, March 29, 2010
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment