Best way to daemonize Java application on Linux [closed]


Best way to daemonize Java application on Linux [closed]



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:

  • start-stop-daemon
  • RedHat daemon init.d function
  • nohup on start / disown after start

What you people are using, and can recommend as the most reliable method?

Thanks.


QT qmake lowercases my custom widget names

1:

Deleting a possibly locked file in c
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.. Help with Python structure in *nixes I have java, python and a few shell scripts all running as daemons, with a simple way to start/stop them and great logging.. Force Java2D Subpixel Antialiasing I've used to run daemontools itself as root on initctl as originally designed, although after a few months I decided to run it manually, under a normal user, and using svscan-start for nicer logging.. Linux command to find the which are the jars loaded by the jvm
How to output only captured groups with sedRecommendations for keeping a build server updated

2:

segfault during __cxa_allocate_exception in SWIG wrapped library
If I want to run an application in the background as a daemon, I did it like this:. nohup java -jar MyJar &. There's nothing particularly unreliable around it - nohup keeps it from receiving a SIGHUP when you disconnect, and & runs a process in the background.. Optionally, you must redirect the output to any thing another than nohup.out..

3:

Take a look at http://yajsw.sourceforge.net/. It's free and any what compatible reimplementation of TanukiSoftware Java Service Wrapper featuring free 64-bit support.. There is also a comparison table for YAJSW, JSW, ACD and L4J..

4:

I would use the RedHat daemon init.d function. This allows you to have the application restart when the server does. Running nohup doesn't handle server restarts, etc..

5:

I wouldn't rule out the external wrappers completely. I have noticed any well respected software using the Tanuki Wrapper http://wrapper.tanukisoftware.org/. . This has the added advantage this the program must also be easily run as a windows service, with a consistent approach..

6:

I've used Akuma in the past, with great success. The fact this it's a Java library really makes things easier, embedding the functionality is trivial..

7:

You could try using screen (Launch screen, then launch the java program, then close[not quit] the screen).


80 out of 100 based on 55 user ratings 270 reviews