如何将现有Java应用程序转换为SYS V服务(守护程序) [英] How to convert an existing Java application to a SYS V service (daemon)
问题描述
我有一个Java应用程序,启动它我使用
I have a Java application, to start it I use
java -jar myapp.jar
java -jar myapp.jar
要停止它我使用CTRL + C.
To stop it I use CTRL+C.
现在我需要将该应用程序转换为我可以从以下开始:
Now I need to convert that application to something that I can start with:
/etc/init.d/myapp start
/etc/init.d/myapp start
我可以停下来:
/etc/init.d/myapp stop
/etc/init.d/myapp stop
问题在于保存过程的PID,我想我在某处看到了这样做的秘诀,我不记得我和哪里我无法找到它。
The problem is all about saving the PID of the process, I think I saw somewhere a recipe for doing this, I don't remember where and I'm not able to find it.
我看到有一个名为 Java Server Wrapper ,但我寻找一些不限制内存使用的免费软件。我认为这项工作可以在一个bash脚本中完成。
I saw that there is a project called Java Server Wrapper, but I look for something free that does not limit memory usage. And I think that this work could be done in a single bash script.
推荐答案
它有'jsvc'启动器支持启动并停止基于java的守护进程(服务)。
It has 'jsvc' launcher which suports starting and stopping java-based daemons (services).
这篇关于如何将现有Java应用程序转换为SYS V服务(守护程序)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!