Best way to demonstrate a Java application on Linux

While I found that this question was answered on the SW several times here, I did not find the final answer that works best.

I do not want to use an external shell, since I found that they start the java process at a good level lower than themselves, which potentially reduces performance, so it seems that only shell methods remain.

I still found 3 different shell methods:

  • start stop daemon
  • Redhat daemon init.d function
  • nohup on startup / shutdown after startup

What do you people use and can recommend as the most reliable method?

Thanks.

+6
java linux daemon
source share
7 answers

Although the standard answer to this question looks like jsvc , I use djb daemon tools - a great way to do something in daemons.

I have java, python and several shell scripts that all work as daemons, with an easy way to start / stop them and excellent registration.

I used to start daemontools as root on initctl, as originally developed, but after a few months I decided to start it manually as a regular user and using svscan-start for more convenient logging.

+5
source share

If I want to run the application in the background as a daemon, I do it as follows:

nohup java -jar MyJar &

There is nothing particularly unreliable in this - nohup does not allow you to get SIGHUP on shutdown, but & executes the process in the background.

If you wish, you can redirect the output to something other than nohup.out .

+5
source share

Take a look at http://yajsw.sourceforge.net/ . This is a free and somewhat compatible upgrade of TanukiSoftware Java Service Wrapper with free 64-bit support.

There is also a comparison table for YAJSW , JSW , ACD and L4J .

+3
source share

I would use the init.d daemon RedHat function. This allows you to restart the application while the server is running. Running nohup does not handle server reboots, etc.

+2
source share

I would not rule out outer wrappers completely.
I noticed some respected software using Tanuki Wrapper http://wrapper.tanukisoftware.org/ .

This has the added benefit that the program can also be easily launched as a Windows service with a consistent approach.

+1
source share

I have used Akuma in the past, with great success. The fact that the Java library really simplifies the work, embeds functionality trivially.

+1
source share

You can try using screen (launch the screen, then launch the java program, and then close the [do not close] screen)

-one
source share

All Articles