How to run a Java program as a daemon using Jsvc

I use Jsvc to run a java program that implements the Daemon interface. However, when I issue the command

/usr/bin/jsvc -user walikha -home $JAVE_HOME -outfile out.file -errfile '$1' Jooist.Server.jar Main 

However, the team silently executes and prompts. How to determine if a daemon is working? In the Java executable, the init, start, stop and destroy functions are simply printed in the log file using Log4J. A log file is not created, and there is no indication that the service is running. Am I missing something or am I missing something while setting up and installing Jsvc?

+4
source share
3 answers

Modify your command to include the -outfile and -errfile options and provide your own path to the log files.

 /usr/bin/jsvc -outfile app.out -errfile app.err -user walikha -home $JAVE_HOME -outfile out.file -errfile '$1' Jooist.Server.jar Main 
+1
source

You can start the service as a daemon by adding your application in the script /etc/init.d/ start/stop .

0
source

Try using the -debug switch and see what happens. However, it looks like you missed, including commons-daemon-1.0.10.jar in your class path.

0
source

Source: https://habr.com/ru/post/1380353/


All Articles