----- Original Message -----
Sent: Tuesday, October 22, 2002 2:33 PM
Subject: [ilugd]: Background process killed

Hi All
  I am facing a strange situation. I running a process witn &(background) and gets killed when I close the session. However it does not happen with other processes. The thing was rectified when I ran the process with nohup option.
Can someone explain this behaviour.
 
All processes "initiated by a user" will always be terminated once the user closes the session (logs off the computer).
 
In the case a user wishes to have a process run even after a close of session using the "nohup" option will keep the process executing until the job is finished.
 
example:
 
nohup find /home -type f -name .bash_history > history_output 2> error_file &
 
now if the user logs off the process would continue running and the output and error messages if any would be stored in history_output and error_file respectively. With the "&" at the end the user could get the prompt to log off the computer. Alternatively the user could have started the process with the "nohup" option and not with the "&" at the end and at a later point in time want to send the process to the background and then logoff the system, he would first press CTRL + Z to suspend the executing process then type "bg" to send the suspended process in the background and then logoff the session and still have the program executing. In case the program generates an output and no output file has been specified a file with the name "nohup.out" is created into which the output is automatically stored.

 
 
 
I have some questions.....
1. Whats the diff between running a process in background and running a process with nohup in background?
2. Does a process should get killed by itself whenever I logout out of this session or not?
 
 
Thx
Vikas

Reply via email to