Skip to content

Instantly share code, notes, and snippets.

@dkhenry
Created January 6, 2013 21:28
Show Gist options
  • Star 9 You must be signed in to star a gist
  • Fork 5 You must be signed in to fork a gist
  • Save dkhenry/4470375 to your computer and use it in GitHub Desktop.
Save dkhenry/4470375 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=<path>/RUNNING_PID
 
ExecStartPre=/bin/sh -c 'cd <path> ;/bin/rm RUNNING_PID ; sbt clean compile stage'
ExecStart=<path>/target/start
ExecStop=/bin/kill $MAINPID
ExecStopPost=/bin/rm <path>/RUNNING_PID
ExecRestart=/bin/kill $MAINPID
Restart=true
 
[Install]
WantedBy=multi-user.target
@freiguy1
Copy link

When I've tried this script with systemd, it always times out whilst compiling the project. Is there a work around for that (increasing systemd timeout time), or another way to remedy it? Thanks!

@dkhenry
Copy link
Author

dkhenry commented Sep 27, 2013

I don't know this is what I have working for me on a smaller site. I think I might move the sbt command into a seperate script and only run the start script from the systemd file

@yuba
Copy link

yuba commented Feb 24, 2015

Works perfect!
Thank you.

@devseevali
Copy link

A working script on CentOS 7 for GitPitch is located here -> https://gist.github.com/devseevali/9ec2aeb13df90755b93c9690b65fc2fc

@TimFoerster
Copy link

Script for CentOS 7 & 8 without producing any errors or warnings

https://gist.github.com/TimFoerster/53ff13645fdcf3009e3202447fb841ea

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