Questions tagged [nohup]

The nohup standard utility and the nohup builtin from shells like csh, which cause the SIGHUP signal to be ignored

If you're using the tag, and are specifically using the GNU/coreutils implementation (the default on desktop and server Linux distros), also add or , since the GNU implementation also redirects the output of the command from a non-readable file, which results in behaviour not specified by the POSIX standard. If your question is about running processes in background, also add or , and any other relevant tags; do NOT use as an umbrella term for long-running jobs which should survive a logout or similar.

275 questions
772
votes
5 answers

Difference between nohup, disown and &

What are the differences between $ nohup foo and $ foo & and $ foo & $ disown
Lesmana
  • 26,889
  • 20
  • 81
  • 86
189
votes
5 answers

Is there a way to redirect nohup output to a log file other than nohup.out?

I frequently use the program nohup so that my processes are immune to hangups. So if I want to make the program program immune to hangups, I use the command nohup program & where & puts the process in the background. When starting, nohup gives me…
Andrew
  • 16,315
  • 34
  • 73
  • 77
72
votes
4 answers

Why use "nohup &" rather than "exec &"

I know that, nohup being a binary, it can be reached from any shell. But the exec built-in probably exists in every shell. Is there a reason to prefer one of them, to the other?
loxaxs
  • 1,824
  • 1
  • 17
  • 14
67
votes
7 answers

How to Execute multiple command using nohup

I need to execute multiple commands using nohup. Each command should be executed after the previous command. I used this command as an example: nohup wget $url && wget $url2 > /dev/null 2>&1 & However that command did not work. What command should…
Ehsan
  • 883
  • 2
  • 7
  • 10
61
votes
7 answers

Execute remote commands, completely detaching from the ssh connection

I have 2 computers, localpc and remoteserver. I need localpc to execute some commands on remoteserver. One of the things it needs to do is start a backup script that runs for a number of hours. I would like the command on localpc to “fire” and then…
LVLAaron
  • 1,715
  • 8
  • 28
  • 31
51
votes
4 answers

nohup vs. Screen

In the past, I've used nohup to run big background jobs, but I've noticed that a lot of people use screen in this context. Does screen provide some kind of functional advantage that I am unaware of, or is it just a matter of preference?
nedblorf
39
votes
4 answers

nohup: ignoring input - what does it mean?

I am using nohup command from a while like nohup bash life.bash > nohup.out 2> nohup.err & In the nohup.err file I always have a line nohup: ignoring input. Can you please help me figure out what it means?
star
  • 585
  • 3
  • 6
  • 17
36
votes
4 answers

When do you need 'nohup' if you're already forking using '&'?

First this question is related but definitely not the same as this very nice question: Difference between nohup, disown and & I want to understand something: when I do '&', I'm forking right? Is it ever useful to do "nohup ... &" or is simply &…
Cedric Martin
  • 2,777
  • 6
  • 28
  • 32
30
votes
3 answers

nohup: ignoring input and redirecting stderr to stdout

I am starting my application in the background using nohup as mentioned below - root@phx5qa01c:/bezook# nohup java -jar ./exhibitor-1.5.1/lib/exhibitor-1.5.1-jar-with-dependencies.jar -c file --fsconfigdir /opt/exhibitor/conf --hostname…
arsenal
  • 3,053
  • 17
  • 44
  • 49
24
votes
2 answers

Is it possible for nohup to write the output both to the file nohup.out AND to the screen/terminal?

I am using the bash shell. I frequently use nohup to ensure that my processes are not stopped when I close the shell/terminal that started them. I use a syntax like: nohup myprocess When starting, nohup gives the message: nohup: ignoring input…
Andrew
  • 16,315
  • 34
  • 73
  • 77
24
votes
2 answers

Do `disown -h` and `nohup` work effectively the same?

disown causes a shell not to send SIGHUP to its disowned job when the shell terminates, and removes the disowned job from the shell's job control. Is the first the result of the second? In other words, if a process started from a shell is…
Tim
  • 98,580
  • 191
  • 570
  • 977
24
votes
1 answer

Exiting terminal running "nohup ./my_script &" => "You have running jobs". OK to exit?

Say I run the following on a remote box with the idea of preventing killing the job when I disconnect the terminal. nohup ./my_script.sh & When I try to exit my terminal, I got the following warning: zsh: you have running jobs I presume that's ok.…
Amelio Vazquez-Reina
  • 40,169
  • 77
  • 197
  • 294
21
votes
1 answer

How to make nohup not create any output files and so not eat all space?

So I start some server with nohup ./myServer &, I actually have loging mon my server so I do not need any help from nohup with it, but any way I get 66GB nohup.out file in fiew days and that is a problem. I want just to start an app, leve it working…
Kabumbus
  • 353
  • 1
  • 2
  • 7
20
votes
1 answer

How can I set environment variables for a program executed using `nohup`?

(I'm editing an existing Bash script, so I'm probably making a silly mistake here...) I have a shell script that saves a command with an environment variable as its argument like this: COMMAND="mvn clean install -P $MAVEN_PROFILE" It then executes…
Vincent
  • 303
  • 1
  • 2
  • 5
19
votes
4 answers

Running multiple nohup commands in background

Got two commands cmd1 and cmd2. Of the two, cmd2 takes longer to finish. Need to run cmd2 and then cmd1. Tried to run them in following way: bash$ (nohup ./cmd2>result2 &) && nohup ./cmd1>result1 & or bash$ (nohup ./cmd2>result2 &) ; nohup…
user33767
  • 191
  • 1
  • 1
  • 3
1
2 3
18 19