在Linux上守护Java应用程序的最佳方法 [英] Best way to daemonize Java application on Linux
问题描述
虽然我多次在SW上发现这个问题的答案,但我没有找到最后的答案。
我不是在寻找使用任何外部包装器,因为我发现它们在低于自身的低级别下启动java进程,这可能会降低性能,所以似乎只剩下shell方法。
<到目前为止,我发现了3种不同的shell方法:
- start-stop-daemon
- RedHat守护进程init.d功能
- 启动后启动/拒绝nohup
你的人是什么使用,并建议作为最可靠的方法?
谢谢。
虽然标准答案似乎是 jsvc ,但我一直在使用djb的守护进程工具成为一个守护进程的好方法。
我有java,python和一些shell脚本都作为守护进程运行,有一个简单的启动/停止方式他们和伟大的日志记录。
我曾经在初始设计的initctl上以root身份运行daemontools本身,但几个月后我决定手动运行它,在一个普通用户,并使用 svscan-start 进行更好的日志记录。
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.
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.
I have java, python and a few shell scripts all running as daemons, with a simple way to start/stop them and great logging.
I've used to run daemontools itself as root on initctl as originally designed, but after a few months I decided to run it manually, under a normal user, and using svscan-start for nicer logging.
这篇关于在Linux上守护Java应用程序的最佳方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!