from http://www.gnu.org/software/coreutils/manual/html_node/nohup-invocation.htmlnohup runs the given command with hangup signals ignored, so that the  command can continue running in the background after you log out.Synopsis: nohup command [arg]...If standard input is a terminal,  redirect it so that terminal sessions do not mistakenly consider the  terminal to be used by the command. Why do we need to do this:Make the substitute file  descriptor unreadable, so that commands that mistakenly attempt to read from standard input can report an error.Isn't redirection stdin from a file done by nohup command [arg]... 0<myfile? why 0>/dev/null?This redirection is a GNU extension; programs intended to be portable to non-GNU hosts can use nohup command [arg]... 0>/dev/null instead.
Stdin input to a command with nohup
io redirection;nohup
Imagine you are trying to run a complex script with nohup. You can detect if it tries to read stdin by redirecting stdin to a file descriptor that cannot be read from.  Look at these two examples: first 0</dev/null:rm nohup.outnohup sh -c 'head -1' 0</dev/nullecho $?cat nohup.out The nohup.out file is empty, and the return code ($?) from the script is 0 ie ok, as the script just read end-of-file.  Now try the same script with 0>/dev/null ie 0 opened for output only:rm nohup.outnohup sh -c 'head -1' 0>/dev/nullecho $?cat nohup.out This gives the error message in nohup.out ofhead: error reading 'standard input': Bad file descriptorand the exit code is 1, fail.  This is presumably more useful to you. You can also get the same effect by closing stdin with 0<&-:rm nohup.outnohup sh -c 'head -1' 0<&-echo $?cat nohup.out 