1.nohup
Purpose: To run the command without hanging off.
Syntax: Nohup Command [Arg ...] [&]
The output is appended to the Nohup.out file in the current directory, regardless of whether the output of the Nohup command is redirected to the terminal.
If the nohup.out file for the current directory is not writable, the output is redirected to the $HOME/nohup.out file.
If no file can be created or opened for appending, then the command specified by the commands parameter is not callable.
Exit Status: The command returns the following exit values:
126 you can find but not invoke commands specified by the command parameter.
The 127 nohup command has an error or cannot find the command specified by the commands parameter.
Otherwise, the exit status of the Nohup command is the command parameter that specifies the exit state of the commands.
2.&
Purpose: Run in the background
Generally two one
Nohup Command &
eg
|
nohup /usr/local/node/bin/node /www/im/chat.js >> /usr/local/node/output.log 2>&1 & |
Process number 7585
To view a running background process
(1) jobs-l
The jobs command only looks at the current terminal in effect, after shutting down the terminal, in another terminal jobs can not see the background running program, the use of PS (Process view command)
(2) Ps-ef
A: Show All Programs U: Display x in user-oriented format: Show All Programs, do not differentiate by terminal
Nohup and & background run, process view and termination