12

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?

  • If you're going to do the redirections yourself, you have almost no use for nohup at all; bash life.bash >life.out 2>life.err </dev/null & disown -h "$!" does the same using only functionality built into the shell itself. – Charles Duffy Jul 28 '17 at 17:19
11

That’s just nohup telling you what it’s set up; it outputs that to its standard error, which you’ve redirected to nohup.err. You can avoid the message by redirecting its standard input:

nohup bash life.bash > nohup.out 2> nohup.err < /dev/null &

nohup checks its standard input, standard output and standard error to see which are connected to a terminal; if it finds any which are connected, it handles them as appropriate (ignoring input, redirecting output to nohup.out, redirecting error to standard output), and tells you what it’s done. If it doesn’t find anything it needs to disconnect, it doesn’t output anything itself.

5

nohup is telling you exactly what it's doing, that it's ignoring input.

If you want to avoid this message, redirect stdin from /dev/null like this

nohup bash life.bash </dev/null >nohup.out 2>nohup.err &
2
man nohup

"If standard input is a terminal, redirect it from an unreadable file."

Hence,

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

It is doing what it is supposed to do, notwithstanding OPTION entries, that's why input is being discarded.

ALSO It seems you are making redundant use of redirection. nohup already creates a nohup.out for you and, if all's working OK, stderr should be also redirected there.

Cheers!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.