Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

As I'm using Debian, and as the packages in the package manager aren't quite up-to-date, I'm forced to do a manual installation.

I downloaded the latest version as a .tar.gz file, and extracted it to /opt. Now I'm unsure on what to do next.

I need to have Jetty run as a service on startup, for every user on this PC. But how? I couldn't find anything in the documentation.

share|improve this question
up vote 2 down vote accepted

If you can not find jetty.sh just download last one http://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk/jetty-distribution/src/main/resources/bin/jetty.sh

And save it to /etc/init.d/jetty

Also you may need to edit /etc/default/jetty to set your individual settings like:

JAVA_HOME=
JAVA_OPTIONS=
JETTY_HOME=
JETTY_USER=
JETTY_LOGS=

If you want service start after reboot do not forget add it to default startup level with update-rc.d

share|improve this answer
    
Thx, that should solve all my problems :-). – Trollhorn Apr 20 '11 at 16:02

There should be a jetty.sh script into the bin directory. I don't know if it works under Debian, but it should be a good starting point.

share|improve this answer

For CentOS 7 Linux I have downloaded the latest Jetty distribution and created the file /etc/systemd/system/jetty.service:

[Unit]
Description=Jetty
After=network-online.target

[Service]
Type=simple
User=jetty
Group=jetty
ExecStart=/usr/bin/java -jar /usr/share/java/jetty-distribution-9.3.10.v20160621/start.jar jetty.home=/usr/share/java/jetty-distribution-9.3.10.v20160621 jetty.base=/var/www/jetty jetty.http.port=8080
ExecStop=/bin/kill ${MAINPID}
SuccessExitStatus=143

[Install]
WantedBy=multi-user.target

Then I have run the commands to create the user and the base dir:

# useradd -s /sbin/nologin jetty

# java -jar /usr/share/java/jetty-distribution-9.3.10.v20160621/start.jar \
      jetty.home=/usr/share/java/jetty-distribution-9.3.10.v20160621 \
      jetty.base=/var/www/jetty \
      --add-to-startd=http,servlet,webapp,deploy,resources,ext,fcgi,websocket,proxy-protocol

# chown -R jetty.jetty /var/www/jetty

Then I have activated the new service:

# systemctl enable jetty

# systemctl start jetty

And finally checked the logs:

# systemctl status -l jetty

And verified that Jetty is listening at the port 8080:

# netstat -an | grep -w LISTEN

I think the commands on Debian Linux would be similar...

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.