Linux Daemon written in Java site

I am currently writing a Java daemon. I am writing a script that will have standard daemon commands (start, stop, restart, status), and I'm trying to decide where everything should go when the daemon is installed.

My current idea is:
PID file: /var/run/myapp.pid
Daemon Script: /etc/init.d/myapp
Java application (.jar): / usr / bin / myapp
Logs: /var/log/myapp.err , /var/log/myapp.log , /var/log/myapp.info (you get the idea)
Configurations: /etc/myapp.conf (or / etc / myapp / configs-go-here if I have more than one in future )

I'm still new to the Linux directory structure, so if I do something wrong, let me know. What confuses me is that my Java application is a .jar file (archive), not a binary. Does this mean that / usr / bin / is not the "right" place for it?

+3
source share
2 answers

You can put the file .jarin /usr/lib/myapp/myapp.jarand make script run dojava -j /usr/lib/myapp/myapp.jar

Looking at this side, the can is actually a library used by the binary /usr/bin/java, so these locations look good to me.

+2
source

/usr/lib/myapp/myapp.jar , /usr/lib , , Java jar , /usr/share/myapp/myapp.jar - .

+2

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


All Articles