Linux - nohup (No Hangup)

Bash Liste Des Attaques Ovh

About

nohup is a POSIX command to ignore the HUP (hangup) signal, enabling the command to keep running after the user who issues the command has logged out.

nohup is most often used to run script or command in the background as daemons. Output that would normally go to the terminal goes to a file called nohup.out if it has not already been redirected. This command is very helpful when there is a need to run numerous batch jobs which are inter-dependent.

$ nohup ./myscript > mystdoutput.log&

Don't forget the ampersand.

Process

Nohup effectively separate the process from the terminal:

  • It closes standard input (the program will not be able to read any input, even if it is run in the foreground. it is not halted, but will receive an error code or EOF).
  • It redirects standard output and standard error to the file nohup.out, so the program won't fail for writing to standard output if the terminal fails, so whatever the process writes is not lost.
  • It prevents the process from receiving a SIGHUP (thus the name).

nohup doesn't put the job in the background but since a foreground nohup job is more or less useless, you'd generally put it into the background using &. Unlike with disown, the shell will still tell you when the nohup job has completed (unless the shell is terminated before, of course).

Documentation / Reference





Discover More
Bash Liste Des Attaques Ovh
Bash - Script

This page is Os Shell scripts (with a accent on the Bash shell) A Bash or Shell Script is a text file that: has a shebang has the executable permission. File extensions are meaningless in UNIX,...
Bash Liste Des Attaques Ovh
Bash - process

This article is the bash Process. To see how to manage another general linux process, see The process running the command is created. The process inherits the stdin, stdout, and stderr from...



Share this page:
Follow us:
Task Runner