Linux – Deploy Jetty as port 80 daemon on Linux

daemonjavajettylinuxweb-server

I'm curious what techniques you Linux admin gods are using to manage your Jetty deployments. I come from a Windows Server background so I'm still getting used to all of this. I've been looking for a good solution for deploying Jetty instances as port 80 on a Linux installation.

So far I've seen this thread which allows Jetty to run as a daemon:

http://jira.codehaus.org/browse/JETTY-458

And I've seen this thread which talks about alternates for setting up on port 80:

http://wiki.eclipse.org/Jetty/Howto/Port80

These all seemed kind of hacky. Surely there is a relatively standard way of deploying a web server like Jetty on Linux. I'm currently using CentOS 5.5 but open to other distros.

Thanks in advance.

Best Answer

Unfortunately, Java processes tend not to daemonize as well as other languages. For Jetty, you'll want to use something like daemonize to launch and manage the process.

Edit - some additional details:

After building daemonize (as per instructions in above link), the command line parameters are explained in the generated file daemonize.html. Test it out from the launch command to ensure it works as expected.

Then to launch Jetty at startup, add the daemonize command to an init shell script (e.g., for CentOS/RHEL append /etc/rc.d/rc.local). For example:

#!/bin/bash
#...other startup commands

/path-to/daemonize -c /path-to/jetty/ -p pid.txt -e error.log -o console.log -a /usr/bin/java -jar start.jar