I used the Linux command nohup - run other commands, and ignore the SIGHUP signal
This link: http://codingstandards.iteye.com/blog/835536 (reproduced please indicate the source)
nohup command can be used to execute other commands, and ignore the SIGHUP signal (run a command immune to hangups, with output to a non-tty. Run COMMAND, ignoring hangup signals.) When a virtual terminal network is disconnected, the operating system Send to a running program SIGHUP signal (HUP = HangUP, hang up), by default, this signal will make the program exit.
nohup command is usually used to run a program in the background (& to meet the needs), and a command setsid can do, if installed on the system screen, you can use screen to manage those long-running tasks. Information provided later in this article is a detailed description of these commands, you can refer to this series, "I used Linux command of the screen - a virtual terminal screen manager."
Common formats are as follows:
nohup command [arg] ... &
Run the command command, ignore the SIGHUP signal, the background. Output will be saved to the nohup.out file. `Nohup 'runs the given COMMAND with hangup signals ignored, so that the command can continue running in the background after you log out.
nohup COMMAND [ARG] ...
Following from the info nohup.
If standard input is a terminal, will be redirected to / dev / null. (If standard input is a terminal, it is redirected from `/ dev / null 'so that terminal sessions do not mistakenly consider the terminal to be used by the command. This is a GNU extension; programs intended to be portable to non-GNU hosts should use `nohup COMMAND [ARG] ... </ dev / null 'instead.)
If standard output is a terminal, will be redirected to nohup.out, use append mode, if the file can not be written to redirect to $ HOME / nohup.out file. (If standard output is a terminal, the command's standard output is appended to the file `nohup.out '; if that cannot be written to, it is appended to the file` $ HOME / nohup.out'; and if that cannot be written to, the command is not run. Any `nohup.out 'or` $ HOME / nohup.out' file created by `nohup 'is made readable and writable only to the user, regardless of the current umask settings.)
If the standard error is a terminal, will be output to standard output the same file. (If standard error is a terminal, it is redirected to the same file descriptor as the (possibly-redirected) standard output.)
nohup command does not automatically command the background, so you have to add & after the command, the command into the background. (`Nohup 'does not automatically put the command it runs in the background; you must do that explicitly, by ending the command line with an` &'. Also, `nohup 'does not alter the niceness of COMMAND; use` nice' for that, eg, `nohup nice COMMAND '.)
Note that, with the nohup command can not be built behind the command. (COMMAND must not be a special built-in utility (* note Special built-in utilities ::).)
Exit Code: (Exit status: 126 if COMMAND is found but cannot be invoked, 127 if `nohup 'itself fails or if COMMAND cannot be found, the exit status of COMMAND otherwise)
Example, a background execution of the command trace output
[Root @ new55 test3] # nohup spider & tail-f nohup.out
UUUUUUU [hthttp: / / blog.sina.com.cn/s/blog_4a3131f00100j4d9.html? Tj = 1]
url = [hthttp: / / blog.sina.com.cn/s/blog_4a3131f00100j4d9.html? tj = 1] schema [hthttp]
spider: test8.cpp: 1051: int extract_url (const std:: string &, PageInfo &, UrlPosMap &): Assertion `false 'failed.
nohup: appending output to "nohup.out"
load spider.xml ok
<url> http://www.sina.com.cn/ </ url>
<prefix> http://www.sina.com.cn/ </ prefix>
<prefix> http://news.sina.com.cn/ </ prefix>
<type> IMG </ type>
start node found
accept node found
ignore node found
Thinking about the
 einit under Linux using the nohup command allows the program is always in the background
 IBM Linux tips: Let the process run in the background are several reliable methods
 IBM study Linux, 101: creating, monitoring and termination process
 IBM Linux Tip: Use the screen to manage your remote session
I used to return the total directory Linux command line