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开发者_JAVA技巧 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.
The build.py script has a 'script' parameter which builds a run-validator.sh
file that runs the validator,
python build/build.py script
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!
Comments are hard to use for code, so here's a reply for running validator in the background:
cd /<path-to>/checker
nohup build/build.py --control-port=8889 run > /dev/null 2>&1 &
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.
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:
cd /<path-to>/checker
python build/build.py script
Next per Dennis' suggestion I used nohup to run the script in the background:
nohup ./run-validator.sh &
This is working great for us on a CentOS 5 server, and doesn't have any of the stdin issues Alex reported.
精彩评论