简体   繁体   English

Java Daemon分步介绍

[英]Java Daemon step by step

Almost finished my java web app. 我的Java Web应用程序差不多完成了。 All working fine. 一切正常。 Whats next. 下一步是什么。 I need now to write some kind of process that runs in back ground to take care of some regular manteinance and send some tweets in a regular basis. 我现在需要编写某种在后台运行的流程,以进行一些常规维护并定期发送一些推文。 From google you can find out that Daemon is the right way. 从谷歌,你可以发现守护进程是正确的方法。

Can anyone guide me step by step how to accomplish this? 谁能指导我逐步实现这一目标? 1- Writing the program. 1-编写程序。 2- And then put it into run in a linux enviroment. 2-然后将其放入Linux环境中运行。 (Keeping it runing if i logoff as user. As Tomcat does). (如果我以用户身份注销,请保持运行。就像Tomcat一样)。 3- If possible start it at linux starts regardless i logon or not. 3-如果可能的话,无论我是否登录,都可以在linux启动时启动。 A URL to a good tutorial will help a lot. 一个好的教程的URL会很有帮助。

Bad news is that my development enviroment is my windows notebook and my production enviroment is Ubunto (Not sure if i can test daemon threads in windows). 坏消息是我的开发环境是Windows笔记本,生产环境是Ubunto(不确定我是否可以在Windows中测试守护程序线程)。

Good news is that have the production server in my house at 4 meters from where i am writing this:) 好消息是,我的生产服务器在我写此文件的地方4米处:)

Thank you very much in advance. 提前非常感谢您。

It's probably easier - and cross platform - to just put that stuff inside your Tomcat server. 将这些内容放入Tomcat服务器可能更容易-并且跨平台-。 Check out the Quartz scheduler , it does what cron does and more, is easily integrated in a web app and allows you to call jobs written in Java without any complicated plumbing. 检出Quartz调度程序 ,它可以执行cron的工作以及执行更多操作,可以轻松地集成到Web应用程序中,并允许您调用用Java编写的作业,而无需任何复杂的工作。 As an added advantage, these jobs are deployable just like any other web app in Tomcat. 另外一个优点是,这些作业可以像Tomcat中的任何其他Web应用程序一样进行部署。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM