I used the Linux command nohup - run other commands, and ignore the SIGHUP signal

2010-12-07  来源:本站原创  分类:OS  人气:215 

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)

Use Description

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 parameters

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)

Use examples

Example, a background execution of the command trace output

[Root @ new55 test3] # nohup spider & tail-f nohup.out
[1] 18162
UUUUUUU [http://news.sina.com.cn/w/2010-09-20/084518138839s.shtml]
UUUUUUU [http://news.sina.com.cn/w/2010-06-20/090817680377s.shtml]
UUUUUUU [http://news.sina.com.cn/w/2010-06-18/164717673976s.shtml]
UUUUUUU [http://news.sina.com.cn/w/2010-06-18/075520496242.shtml]
UUUUUUU [http://news.sina.com.cn/w/2010-06-18/031720494028.shtml]
UUUUUUU [http://news.sina.com.cn/w/2010-06-18/101720497276.shtml]
UUUUUUU [http://i1.sinaimg.cn/dy/2010/0624/S12709T1277336424126.jpg]
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
<spider>
<start>
<url> http://www.sina.com.cn/ </ url>
</ Start>
<accept>
<prefix> http://www.sina.com.cn/ </ prefix>
<prefix> http://news.sina.com.cn/ </ prefix>
</ Accept>
<ignore>
<type> IMG </ type>
</ Ignore>
</ Spider>
start node found
url http://www.sina.com.cn/
accept node found
prefix http://www.sina.com.cn/
prefix http://news.sina.com.cn/
ignore node found
type IMG

Thinking about the

Information

[1] einit under Linux using the nohup command allows the program is always in the background
[2] IBM Linux tips: Let the process run in the background are several reliable methods
[3] IBM study Linux, 101: creating, monitoring and termination process
[4] IBM Linux Tip: Use the screen to manage your remote session

I used to return the total directory Linux command line

相关文章
  • I used the Linux command nohup - run other commands, and ignore the SIGHUP signal 2010-12-07

    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) Use Description nohup command can be used to execute other commands, and

  • I used the Linux command ifconfig - Network Configuration Commands 2011-07-21

    I used the Linux command ifconfig - Network Configuration Commands This link: http://codingstandards.iteye.com/blog/1130135 (reproduced please indicate the source) Use Description ifconfig command used to display the system's network interface (NIC)

  • I used Linux command of the kill - terminate the process / send a signal 2010-12-20

    I used Linux command of the kill - terminate the process / send a signal This link: http://codingstandards.javaeye.com/blog/847299 (reprint, please indicate the source) Use Description kill command to terminate the specified process (terminate a proc

  • I used the Linux command line List (update 4.17, 94) 2010-10-17

    I used the Linux command line List This link: http://codingstandards.iteye.com/blog/786653 (reproduced please indicate the source) Outline Type of command The table lists the I exhausted all my memory sorting out the Linux command, which on the exter

  • I used the Linux command line List (7.2 update 98) 2011-07-02

    I used the Linux command line List (7.2 update 98) This link: http://codingstandards.iteye.com/blog/786653 (reproduced please indicate the source) Outline Type of command The table lists the I exhausted all my memory sorting out the Linux command, wh

  • Xiang Jie common Linux command line svn command 2010-03-31

    This article describes common Linux command line use svn command, in the hope of help to you. 1, Linux command line checkout files to a local directory svn checkout path (path is the directory on the server) For example: svn checkout svn: / / 192.168

  • I used Linux command of the trap - signal processing in the script 2010-12-08

    I used Linux command of the trap - signal processing in the script This link: http://codingstandards.javaeye.com/blog/836588 (reprint, please indicate the source) Use Description rap is a shell built-in command, which is used in a script how to handl

  • Linux with the nohup command to run in the background under the program will never 2011-05-20

    Unix / Linux under the General wanted a program running in the background, many of which are used & in the program at the end to let the program run automatically. For example, we want to run mysql in the background: / Usr / local / mysql / bin / mys

  • You may encounter problems nohup command, nohup command here will introduce the solution to the problem, Linux is the operating system itself, the core of which is the operating system kernel, the kernel is the completion of the basic operation of those 2010-12-02

    You may encounter problems nohup command, nohup command here will introduce the solution to the problem, Linux is the operating system itself, the core of which is the operating system kernel. The kernel is the basic operating procedures are complete

  • Run linux command (Reprinted) 2011-01-13

    Android to run an external command to achieve the underlying linux android is actually the underlying Linux kernel, of course, you can run linux shell command environment, especially through the root system of dealing with the android, basically linu

  • [Reproduced] in a Linux environment to run DOS command 2011-06-13

    Linux commands in a DOS command to run under Linux Linux system provides a set known as the mtools the portable tool that allows users to easily from the standard DOS floppy disk read and write files and directories. Their DOS and Linux environments

  • Linux powerful nohup (process behind the scenes) 2011-06-08

    Reproduced: http://baike.baidu.com/view/1839401.htm nohup Uses: LINUX command usage, do not hang up the run command. Syntax: nohup Command [Arg ...] [&] Description: nohup command to run the Command parameter and any related Arg parameters specified

  • linux command find find files 2010-03-13

    Each of the operating system by thousands of different types of documents composed. Which comes with the file system itself, the user's own documents, as well as share files and so on. Sometimes we often forget that a document on the hard drive which

  • The most common Linux command basic operations 2010-03-25

    Linux command basic operations http://www.chinaitpower.com/A/2003-02-18/50468.html First introduced the term "console (console)", it is the use of characters we usually see the interface of man-machine interface, such as dos. We say that the con

  • unix / linux command summary 2010-04-25

    UNIX system operation commands one user login and log out before the system administrator must first register for a user name, regardless of where computer users log on to the ITPNET will access the same file system. 1.1 log when the Login prompt app

  • linux command Daquan 2010-07-07

    http://www.pixelbeat.org/cmdline.html This is a linux command line reference for common operations. Examples marked with • are valid / safe to paste without modification into a terminal, so you may want to keep a Terminal window Open while reading th

  • Windows and Linux systems to run side under JAVA 2010-07-31

    JAVA-classpath command that is the introduction of packet, if a project is required to run the package that contains other words can be written: "java-classpath.; .. LibXXX.jar; javafilename", which is under the Windows system command statements

  • Achieved with the Linux command line SQL, groupby 2010-08-16

    Achieved with the Linux command line SQL, groupby Demand Given a sql script file, which all insert operations, the sample is as follows: insert into `passport_daily` (uid, loginname, ip, operatetime, result) values ('9454268 ',' [email protected] ', '

  • linux command summary (1) 2010-08-30

    vi editor Command mode, edit mode, save the operating mode: wq or: x Quit: q! View process ps-ef | grep java Kill process kill -9 process ID Force delete files rm-rf file Delete Files rz-e Extracting zip file unzip accountant.zip jboss Start nohup. /

  • Development of Linux command line utility 2010-09-21

    http://www.ibm.com/developerworks/cn/linux/shell/clutil/ This article will guide you to learn how to write even to the end user, simple enough Linux command line utility. This paper outlines best practices and reliable command-line start, and a detai