I'm currently writing a Java daemon. I'm writing a script that will have the standard daemon commands (start, stop, restart, status) and I'm trying to decide on where things should go when installing the daemon.
My current idea is:
PID File: /开发者_开发技巧var/run/myapp.pid Daemon Script: /etc/init.d/myapp Java App (.jar): /usr/bin/myapp Logs: /var/log/myapp.err, /var/log/myapp.log, /var/log/myapp.info (you get the idea) Configs: /etc/myapp.conf (or /etc/myapp/configs-go-here if I have more than one in the future)I'm still new to the Linux directory structure so if I'm doing something wrong let me know. Whats confusing me the most is that my Java app is a .jar file (archive) and not a binary. So does that mean that /usr/bin/ isn't the "right" place for it?
You could put the .jar
file in /usr/lib/myapp/myapp.jar
and make the startup script do java -j /usr/lib/myapp/myapp.jar
Looking it from that side, the jar is effectively a library that the /usr/bin/java
binary uses, so those locations look good to me.
The /usr/lib/myapp/myapp.jar
suggestion is on the right track, but /usr/lib
is for architecture-specific files - since Java jar
archives are platform-independent, /usr/share/myapp/myapp.jar
is a better location.
精彩评论