Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ nohup(1) — OSF/1 1.0 (TIN) MIPS

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

csh(1)

nice(1)

sh(1)

sigaction(2)

nohup(1)  —  Commands

OSF

NAME

nohup − Runs a command without hangups and quits

SYNOPSIS

nohup command [argument ...]

DESCRIPTION

The nohup command runs command, ignoring all hangups and QUIT signals.  You can use this command to run programs in the background after logging off of 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 nohup.out is not writable in the current directory, the output is redirected to $HOME/nohup.out. 

The nohup command accepts just one command 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 command using the following format:

nohup sh file

You can also assign the shell file execute permission and run it as the command 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 that of the background process started by an & (ampersand). The $ (dollar sign) is the shell prompt. The following is a message informing 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, command may not run at all.  Once command has started, logging out will not affect it. 

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

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 &

NOTES

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). 

RELATED INFORMATION

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

Functions: sigaction(2). 
 

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