manpagez: man pages & more
info coreutils
Home | html | info | man
[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

22.4 nohup: Run a command immune to hangups

nohup runs the given command with hangup signals ignored, so that the command can continue running in the background after you log out. Synopsis:

nohup command [arg]…

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, 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 standard error is a terminal, it is normally redirected to the same file descriptor as the (possibly-redirected) standard output. However, if standard output is closed, standard error terminal output is instead appended to the file ‘nohup.out’ or ‘$HOME/nohup.out’ as above.

To capture the command's output to a file other than ‘nohup.out’ you can redirect it. For example, to capture the output of make:

nohup make > make.log

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, e.g., ‘nohup nice command’.

command must not be a special built-in utility (see section Special built-in utilities).

The only options are ‘--help’ and ‘--version’. See section Common options. Options must precede operands.

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

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]
© 2000-2017
Individual documents may contain additional copyright information.