Skip to content

Instantly share code, notes, and snippets.

@TimFoerster
Forked from devseevali/play2.service
Last active January 17, 2021 19:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TimFoerster/53ff13645fdcf3009e3202447fb841ea to your computer and use it in GitHub Desktop.
Save TimFoerster/53ff13645fdcf3009e3202447fb841ea to your computer and use it in GitHub Desktop.
Systemd script for the Play Framework
[Unit]
Description=Play2 Service for <service-name>
After=network.target
 
[Service]
Type=simple
PIDFile=<path>/RUNNING_PID
WorkingDirectory=<path>
ExecStartPre=/bin/rm -f <path>/RUNNING_PID
ExecStart=<path>/bin/<service-name> -Dconfig.resource=production.conf -Duser.timezone=UTC
ExecStop=/bin/kill $MAINPID
ExecStopPost=/bin/rm -f <path>/RUNNING_PID
ExecReload=/bin/kill $MAINPID
Restart=always
User=<user>
Group=<usergroup>
# See http://serverfault.com/a/695863
SuccessExitStatus=143
[Install]
WantedBy=multi-user.target
@TimFoerster
Copy link
Author

Tested with cent OS 7 & 8 without producing any errors or warnings.

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