Skip to content

Instantly share code, notes, and snippets.

@canariecaf
Created February 10, 2016 18:06
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save canariecaf/0fdd6db9e4f294afca79 to your computer and use it in GitHub Desktop.
Save canariecaf/0fdd6db9e4f294afca79 to your computer and use it in GitHub Desktop.
jetty.service file
#
# A basic systemd configuration for Jetty to start on boot
#
# Uses the Service scenario of 'oneshot' run as root
# and once the process has run, it is considered successful
# regardless of error code (even 'FAILURE') as jetty
# may take longer to start than jetty.sh observes it's logs
# for.
#
#
[Unit]
Description=Jetty Web Application Server
After=network.target
[Install]
WantedBy=multi-user.target
Alias=jetty.service
[Service]
Type=oneshot
# Execute pre and post scripts as root
PermissionsStartOnly=true
# The process will be considered active after it exits
RemainAfterExit=yes
# Note on the Start we do not wait for successful start.
# This is to allow the container to run beyond the jetty shell script
# in cases where it takes very long to start and results in jetty.sh
# reporting FAILED. It's a false positive on failure.
ExecStart=-/opt/jetty/bin/jetty.sh start
ExecStop=/opt/jetty/bin/jetty.sh stop
ExecReload=/opt/jetty/bin/jetty.sh restart
@danielkeller
Copy link

Thanks, this is very helpful. I've created a variant of this that uses Jetty's pidfile.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment