cancel
Showing results for 
Search instead for 
Did you mean: 
Trevor
Starfighter Starfighter
Starfighter
  • 953 Views

Don't Hang Up

Want to have a process continue run, even after you log out of the current shell you're logged into?  The nohup utility will allow you to do just that!

The nohup command tells the current shell to run a command, and do so by detaching the command's process from the current/active shell.  What this does
is to make the process run independently - when the current/active shell is exited,
the process will continue to run, just as if it were a system service.

The very simply syntax is as follows:     $   nohup  <command>   &
-  command refers to the process that will be running even after logging off
-  Of course you know what the ampersand (&) does

The nohup command works by ignoring the SIGHUP (signal hang up), which is normally sent to a process when its controlling terminal is closed. By ignoring this signal, the process does not stop when the user logs out - allowing the process to
continue running in the background.

 

 

 

 

Trevor "Red Hat Evangelist" Chandler
Labels (3)
4 Replies
Chetan_Tiwary_
Community Manager
Community Manager
  • 940 Views

@Trevor if you are married you can tell for sure when the wife calls, it is basically wrapped up with nohup so that even if the call disconnects, you keep on executing the orders in the background !!!!!!

Anyways adding onto this, 5 things to keep in mind :

1. You need to install coreutils to use this command.

2. When a process is launched using nohup, it operates independently of the shell that initiated it. This means it explicitly disconnects from the standard input (stdin) of the original shell, and instead of inheriting the shell's standard output (stdout) and standard error (stderr), it redirects both of these streams to a file named nohup.out

 

nohup: ignoring input and appending output to 'nohup.out'

3. nohup does not automatically put the command it runs in the background; you must do that explicitly, by ending the command line with an ‘&’ .

 

4. nohup does not alter the niceness of command.

5. Another utility disown can do the same thing with processes that you forgot to run with nohup.

Trevor
Starfighter Starfighter
Starfighter
  • 933 Views

Chetan_Tiwary_, I do the framing, and you do the finishing - which is the most important part in the construction of any facility!!!

As always, thank you for the great addition - that is, the fantastic finishing job!!!!

Trevor "Red Hat Evangelist" Chandler
Blue_bird
Flight Engineer
Flight Engineer
  • 861 Views

Nice..! Thanks for sharing..!

Blue_bird
Flight Engineer
Flight Engineer
  • 861 Views

Thanks for sharing..!

Join the discussion
You must log in to join this conversation.