In LinuxUnix, only the daemon can continue to run without the terminal. when a common process closes the terminal, it exits because it receives the SIGHUP signal (suspended signal. When
In Linux/Unix, only the daemon can continue to run without the terminal. when a common process closes the terminal, it exits because it receives the SIGHUP signal (suspension signal. After the terminal exits, the background program started by the terminal automatically exits.
If you want to run the command in the background, run the command in the background;
If you want to stop running the program after the terminal exits, use the nohup command to start the background program.
Nohup (= no hang up), so that the command ignores the SIGHUP signal;
[Syntax] nohup Command [Arg...] [&]
[Command output description]
If the Command output is not redirected, both stdout and stderr are redirected to nohup. out File; nohup. the out file is written in the current directory by default. if you do not have the write permission in this directory, try to write it to $ HOME/nohup. out. if it still fails, the entire command fails to be executed;
If the Command output is redirected, it is written to the specified redirected file;
[Exit status]
126 The Command can be searched but cannot be called;
127 nohup Command error or Command cannot be found;
Otherwise, the Command exits;
Differences between nohup and:
Nohup only allows the command to ignore the SIGHUP Command;
& Enables the command to run in the background;
Whether the command can be executed after leaving the terminal depends on whether the process is a daemon. if not, nohup is needed to help;
PS, reference http://www.cnblogs.com/allenblogs/archive/2011/05/19/2051136.html
--------- Reference content below
When the shell prompts that nohup is successful, you also need to press any key on the terminal to return to the shell input command window, and then enter exit in the shell to exit the terminal; however, I click the close Program button to close the terminal every time the nohup operation is successful .. Therefore, the session corresponding to the command will be disconnected at this time, and the process corresponding to nohup will be notified and shutdown will be required together.
I did not notice the details, so I recorded them here.