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?
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?
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.
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 &
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!
You can close the STDIN file descriptor
like this: <&-
The whole line would be:
nohup ./script.sh >> ./out 2>&1 <&- &
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