Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ nohup(1) — Digital UNIX 3.2c

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

csh(1)

nice(1)

sh(1)

sigaction(2)

nohup(1)  —  Commands

NAME

nohup − Runs a utility ignoring hangups and quits (see Note)

SYNOPSIS

nohup utility [argument ...]

DESCRIPTION

The nohup command runs utility, ignoring all hangups and QUIT signals.  You can use this command to run programs in the background after logging off the system.  To run a nohup command in the background, add an & (ampersand) to the end of the command. 

If nohup output is redirected to a terminal or is not redirected at all, the output is appended to the file nohup.out.  If the file is created, the permission bits are set to Owner Read and Owner Write (600). If nohup.out is not writable in the current directory, the output is redirected to $HOME/nohup.out.  If neither file can be created nor opened for appending, utility is not invoked. 

The nohup command accepts just one utility as an argument.  To apply nohup to a pipeline or list of commands, enter the pipeline or list in a shell script file.  Then run sh as utility using the following format:

nohup sh -c file

You can also assign the shell file execute permission and run it as the utility in the form:

nohup file

EXAMPLES

     1.To leave a command running after logging out (sh only), enter:

nohup  find  /  -print  &

Shortly after you enter this, the following is displayed:

670
$ Sending output to nohup.out

The process ID number changes to the background process started by the & (ampersand), in this case, 670.  The $ (dollar sign) is the shell prompt.  The message following informs you that the output from the find command is in the file nohup.out. 

Sending output...

You can log out after you see these messages, even if the find command has not finished yet. 

Note that if you are using csh, the built-in command nohup is executed instead of the system command.  To execute the nohup system command, you must enter an absolute path. 

     2.To do the same, but redirect the standard output to a different file, enter:

nohup  find  /  -print  >filenames  &

This runs the find command and stores its output in a file named filenames.  Now only the process ID and prompt are displayed. 

Wait for a second or two before logging out, because the nohup command takes a moment to start the command you specified.  If you log out too quickly, utility may not run at all.  Once utility has started, logging out does not affect it. 

     3.To run more than one command, use a shell script.  For example, if you include the following shell script:

comm -23 fi4 fi5 | comm -23 - fi6 | join -a1 - fi7 > comm.out

and name it ncomm, you can run nohup for all of the commands in ncomm by entering:

nohup sh ncomm

If you assign ncomm Execute permission, you can obtain the same results by issuing the command:

nohup ncomm

To run this command in the background, enter:

nohup ncomm &

FILES

nohup.out

Standard output and standard error file for nohup. 

NOTES

The term utility, rather than the term command, describes the argument to nohup because shell compound commands, pipelines, special built-in programs, and the like, cannot be handled directly. In addition, the term utility includes user application programs and shell scripts, not just the standard utilities. 

The csh command contains a built-in subcommand named nohup.  The command and subcommand do not work the same way.  For information on the csh built-in subcommand, see the csh command.  To invoke the nohup command, use an absolute path (for example /usr/bin/nohup). 

EXIT VALUES

The nohup command returns the following exit values:

126The specified utility was found, but could not be invoked. 

127The error occurred in the nohup utility or the specified utility could not be found. 

The exit status is otherwise that of the utility. 

RELATED INFORMATION

Commands:  csh(1), nice(1), sh(1). 

Functions: sigaction(2). 

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026