To make sure that your application is disassociated from its terminal - so that it will not interfere with foreground commands and will continue to run after you logout - nohup
ensures that neither stdin nor stdout nor stderr are a terminal-like device. The documentation describes what actions it takes:
If the standard output is a terminal, all output written by the named
utility to its standard output shall be appended to the end of the file
nohup.out in the current directory. If nohup.out cannot be created or
opened for appending, the output shall be appended to the end of the file
nohup.out in the directory specified by the HOME environment variable. If
neither file can be created or opened for appending, utility shall not be
invoked.
If the standard error is a terminal, all output written by the named
utility to its standard error shall be redirected to the same file
descriptor as the standard output.
You redirected stdout to a file when you typed > exhibitor.out
in your command line. If you're OK with having your application's stderr be directed to the same file as its stdout, you don't need to do anything else. Or you can redirect stderr to a different file by adding an argument such as 2> exhibitor.err
. (Thanks to an unknown user - my notifications didn't show a name - for suggesting inclusion of this alternative.)
nohup java -jar blaa bla >/tmp/test.out 2>&1 &
/tmp/test.out
can I useexhibitor.out
. Sorry for asking dumb question as I am pretty new to these things..2>&1
?