Hi All,
Can someone help me in knowing the exact difference between nohup and &.
The definition is quite clear but i only want to know if i run my job using & and in between i hung up my terminal.
Hi All,
Can someone help me in knowing the exact difference between nohup and &.
The definition is quite clear but i only want to know if i run my job using & and in between i hung up my terminal.
The definition doesn't seem to be clear. Why don't you try it out?
Hi,
Actually i tried with &. my job is getting killed at terminal logout
Try
nohup <yourscript/command> &
bash has the disown
builtin that makes a background job immune to its parent logging out.
As Rudic said...
Using nohup
and & script can work even if our session stopped/expired. Even if we restart the server script will continue to run automatically.
nohup sh script_name &
My Query is still not answered.
If i only use & and my terminal gets hunged. will by job will continue or will be killed.
Ex : sh my_script.sh &
I think it should be killed...
Is there something preventing you from conducting a simple experiment to answer your query?
Regards,
Alister
It will mostly get "killed" (unless the script has a "no-action" or "some-action-other-than-exit" trap set for the HUP signal). And, as alister said, why don't you try that yourself?
My initial question in post #2 is still not answered as others are asking that too.