Nohup/root/start.sh &
Prompt after carriage return in shell:
[~]$ appending output to Nohup.out
The standard output of the original program is automatically redirected to the Nohup.out file in the current directory, which plays the role of log.
The program runs unaffected after disconnecting from the SSH connection. has been validated
Use jobs to view tasks.
The following is transferred from: http://www.cnblogs.com/allenblogs/archive/2011/05/19/2051136.html
1.nohup
Purpose: To run the command without suspending it.
Syntax: Nohup Command [Arg ...] [&]
Whether or not the output of the Nohup command is redirected to the terminal, the output is appended to the Nohup.out file in the current directory.
If the nohup.out file for the current directory is not writable, the output is redirected to the $HOME/nohup.out file.
If no files can be created or opened for appending, the command specified by the command argument is not callable. Exit Status: This command returns the following export value: 126 You can find but not invoke the command specified by the command parameter. The 127 nohup command has an error or cannot find the command specified by the command parameter. Otherwise, the exit status of the Nohup command is the command parameter that specifies the exit state of the commands.
2.&
Use: Run in the background
Generally two one
Nohup Command &
eg
1 |
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
Jobs command only to see the current terminal effective, close the terminal, in another terminal jobs can not see the background running program, at this time using PS (Process view command)
(2) Ps-ef
A: Show All Programs
u: Display x in user-oriented format
: Show All Programs, not by terminals
Note:
With Ps-def | The grep lookup process is convenient, and the last line will always grep itself
Use the GREP-V parameter to exclude the grep command
1 |
Ps-aux|grep chat.js| Grep-v grep |
And then use awk to extract the process ID.
1 |
Ps-aux|grep chat.js| Grep-v grep | awk ' {print $} ' |
3. If a process does not come up, it may be that a port is occupied
To view a process that uses a port