While I found this question being answered here on SW several times, I didn't find a concluding answer what is the best approach.
I'm not looking to use any external wrapper, as I found them launching the java process under a nice level lower then themselves which potentially lowers the performance, so it seems only the shell methods are left.
I so far found 3 different shell methods:
What you people are using, and can recommend as the most reliable method?
Thanks.
While the standard answer to this seems to be jsvc, I have been using djb's daemon tools to be a great way to make anything into a daemon.
I have java, python and a few shell scripts all running as daemons, with a simple way to start/stop them and great logging.
I've used to run daemontools itself as root on initctl as originally designed, but after a few months I decided to run it manually, under a normal user, and using svscan-start for nicer logging.
If I want to run an application in the background as a daemon, I do it like this:
nohup java -jar MyJar &
There's nothing particularly unreliable about it - nohup
keeps it from receiving a SIGHUP
when you disconnect, and &
runs a process in the background.
Optionally, you can redirect the output to something other than nohup.out
.
Take a look at http://yajsw.sourceforge.net/. It's free and somewhat compatible reimplementation of TanukiSoftware Java Service Wrapper featuring free 64-bit support.
There is also a comparison table for YAJSW, JSW, ACD and L4J.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With