Q:

How to write Play Framework service shell to let it start running on startup

I'm currently working on play2.4 and using activator dist.
activator dist would produce a start script and works perfectly. but I do not know how can I make it running on server's startup?
I wrote a shell file which calls the shell file produced by activator dist though it works if I call it directly but it doesnt as a chkconfig's service.
my current /etc/init.d/ shell file
#!/bin/sh
# chkconfig: 2345 99 10

PORT=80
APP_DIR=application dir here
APP_SHELL= shell file name here

#{APP_DIR}${APP_SHELL} -Dhttp.port=${PORT}

where am I doing wrong? or maybe there is better way to let play project working on server's startup?
P.S
I'm using centos as a server.

A:

Explained here: 
https://www.playframework.com/documentation/2.4.x/Production#The-Native-Packager
using activator dist is equivalent to invoking the universal:packageBin.
So enabling enablePlugins(JavaServerAppPackaging) in sbt plugins. 
Than rpm:packageBin should create a installable rpm package wiht upstart script.

