将基于 Jetty 的 Nu HTML Validator 转换为服务
我正在尝试创建 nu html 验证器 的本地副本。我可以让它在控制台上运行,但我还没有成功让它在后台运行(或作为服务)。
我没有设置 Java Servlet 的经验,因此我正在寻找一些将命令行上的 jetty 应用程序转换为服务的指针。
我使用的机器有 Ubuntu 10.04 Server。
我真的不确定是在这里问这个问题还是在服务器故障上问这个问题。如果它应该在那里的话我可以把它移到那里。
I am trying to create a local copy of the nu html validator. I can get it to run on the console, but I have not been successful in getting it to run in the background (or as a service).
I have no experience setting up Java Servlets, so I am looking for some pointers in converting the jetty application on the command line to a service.
The machine I am using has Ubuntu 10.04 Server.
I am really not sure whether to ask this here or on serverfault. I can move it there if it should be there.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
build.py 脚本有一个 'script' 参数,它构建一个运行验证器的
run-validator.sh
文件,将为您生成脚本,您可以检查此脚本以查看裸java命令。
到目前为止,我还无法在后台运行它,
我认为与标准输入有关(当你按回车键时验证器退出的方式),但我还没有弄清楚!
The build.py script has a 'script' parameter which builds a
run-validator.sh
file that runs the validator,Will generate the script for you, You can inspect this script to see the bare java command.
I have been unable to get this running in the background as of yet,
Something to do with stdin methinks (the way the validator exits when you hit return) but I haven't been able to figure it out yet!
评论很难用于代码,因此以下是在后台运行验证器的答复:
请注意解决stdin问题的控制 - 端口选项。 8889是一个TCP端口,据说可以在连接时停止验证器。无法检查一下,但是您可能需要考虑阻止端口。
Comments are hard to use for code, so here's a reply for running validator in the background:
note the control-port option that solves stdin issues. 8889 is a tcp port that supposedly stops validator when it gets a connection. haven't been able to check that, but you might want to consider blocking the port.
为了解决艾伦提出的验证器退出问题,我实际上结合了艾伦和丹尼斯的答案。
首先,我使用以下方法构建了
run-validator.sh
文件:接下来,根据 Dennis 的建议,我使用 nohup 在后台运行脚本:
这对于我们在 CentOS 5 服务器上的工作非常有用,但并不适用。没有亚历克斯报告的任何标准输入问题。
In order to resolve the validator exiting issue Alan presented, I actually deployed a combination of Alan and Dennis' answer.
First I built the
run-validator.sh
file using:Next per Dennis' suggestion I used nohup to run the script in the background:
This is working great for us on a CentOS 5 server, and doesn't have any of the stdin issues Alex reported.