![]() ![]() Mac os x apache nohup example manual#(Note the distinction: a disowned process gets no signals forwarded to it automatically by its parent shell - but without nohup, it will still receive a HUP signal sent via other means, such as a manual kill command. That will mean the background process is no longer associated with a shell "job" and will not have any signals forwarded to it from the shell. If you want to do the latter, and you are running bash, ksh, or zsh, you can do so by running disown with no argument as the next command. Note, however, that this does not prevent the command from accessing the terminal directly, nor does it remove it from your shell's process group. So the extra-safe version looks like this: nohup command /dev/null 2>&1 & # completely detached from terminal While closing input has no effect on the creation or not of nohup.out, it avoids another problem: if a background process tries to read anything from standard input, it will pause, waiting for you to bring it back to the foreground and type something. On other systems, notably BSD and macOS, that is not the case, so when running in the background, you might want to close input manually. ![]() On Linux, running a job with nohup automatically closes its input as well. If you're using nohup, that probably means you want to run the command in the background by putting another & on the end of the whole thing: nohup command >/dev/null 2>&1 & # runs in background, still doesn't create nohup.out nohup command >/dev/null 2>&1 # doesn't create nohup.out If you have redirected the output of the command somewhere else - including /dev/null - that's where it goes instead. The nohup command only writes to nohup.out if the output would otherwise go to the terminal.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |