Skip to content

Instantly share code, notes, and snippets.

@alchi
Forked from dkhenry/play2.service
Last active February 24, 2016 13:01
Show Gist options
  • Select an option

  • Save alchi/dd657311ca83fb3110ae to your computer and use it in GitHub Desktop.

Select an option

Save alchi/dd657311ca83fb3110ae to your computer and use it in GitHub Desktop.
Systemd script for the Play Framework
[Unit]
Description=Play2 Server for <site>
After=network.target
[Service]
Type=simple
PIDFile=<app_path>/RUNNING_PID
ExecStartPre=/bin/sh -c 'cd <app_path> ;/bin/rm -f RUNNING_PID'
ExecStart=<app_path>/bin/appexec -J-Xms64M -J-Xmx256M -Dhttp.port=9000 -Duser.timezone=Europe/Copenhagen
ExecStop=/bin/kill $MAINPID
ExecStopPost=/bin/rm -f <app_path>/RUNNING_PID
Restart=always
[Install]
WantedBy=multi-user.target
@alchi
Copy link
Author

alchi commented Feb 24, 2016

ExecRestart removed....
Restart value changed from true to always
-f added to rm, so the service does not fail if RUNNING_PID does not exist

Everything according to systemd config page...

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