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...