both case let the program run at background.
the difference is when the shell, which create the the background process, die and the tty (or pts) is release , in first case, the application still run. But to second case, the application will die.
That is based on there is no signal handler for HUP in the applicaion.
nohup means no-HUP. HUP is a signal. When use terminal, if the terminal is turn off, or lines is broke, all the process in that terminal will receive signal HUP (hang up). By default, the process will die. You can setup the signal handler for sig HUP. The command nohup is for it.
I had experience when I just switch program to background by using "CTRL-Z' and bg. Then later, somehow my terminal hang( not die yet, just no response), then all the process in that terminal(pts) hang for ever. Later when I try to run long-time program, i use nohup.
the difference is when the shell, which create the the background process, die and the tty (or pts) is release , in first case, the application still run. But to second case, the application will die.
That is based on there is no signal handler for HUP in the applicaion.
nohup means no-HUP. HUP is a signal. When use terminal, if the terminal is turn off, or lines is broke, all the process in that terminal will receive signal HUP (hang up). By default, the process will die. You can setup the signal handler for sig HUP. The command nohup is for it.
I had experience when I just switch program to background by using "CTRL-Z' and bg. Then later, somehow my terminal hang( not die yet, just no response), then all the process in that terminal(pts) hang for ever. Later when I try to run long-time program, i use nohup.