[2.0] Rename/Ignore/... RUNNING_PID to start multiple play instances?

1,103 views
Skip to first unread message

Stefan

unread,
Jun 1, 2012, 2:57:29 PM6/1/12
to play-fr...@googlegroups.com
hi,

is there a way to prevent the start script from creating the "RUNNING_PID" file or is there a option to use a different name.
in my case I have a upstart script that should start multiple play instances which are balanced behind a haproxy.

my problem is, that these upstart scripts call the start-script with only a different portnumber, but since there may be a running instance from the previous call (which created a RUNNING_PID), the start script won't start a new instance.

I thought of a parameter to rename these files or to prevent play from creating one?

my upstart scripts look like this:

play-instance.conf:

respawn
instance $N

exec start-stop-daemon --chuid $USER:$GROUP --exec ${HOME}/start --start -- -Dhttp.port=900$N -Dconfig.resource=application_prod.conf

play.conf
start on startup

task

script
    start play-instance N=0
    start play-instance N=1
end script

thanks in advance
stefan

Stefan

unread,
Jun 1, 2012, 4:10:05 PM6/1/12
to play-fr...@googlegroups.com
ok, I found something in the framework code: "pidfile.path"

now my call looks like this:

exec start-stop-daemon --pidfile ${HOME}/RUNNING_PID.$N --chuid $USER:$GROUP --exec ${HOME}/start --start -- -Dhttp.port=900$N -Dconfig.resource=$CONFIG -Dpidfile.path=${HOME}/instance$N $EXTRA

before that I create one folder instanceX for each instance X.
this works for me, thx.

cu
stefan

Ben McCann

unread,
Jun 2, 2012, 10:14:56 AM6/2/12
to play-fr...@googlegroups.com
You also might be interested in this pull request I submitted recently to disable the file:

sun

unread,
Jun 2, 2012, 10:42:00 AM6/2/12
to play-framework
You might want to add your finding to the wiki:
https://github.com/playframework/Play20/wiki/ProductionConfiguration

Stefan

unread,
Jun 2, 2012, 2:16:24 PM6/2/12
to play-fr...@googlegroups.com
nice!

thx, this option would be very useful (but I must admit that the pidfile.path fit into my configuration in combination with monitoring tools like monit, which especially has a method to check for a process with a specified pid-file)

Stefan

unread,
Jun 2, 2012, 2:31:18 PM6/2/12
to play-fr...@googlegroups.com
I've added an additional block there

laguiz

unread,
Jun 12, 2014, 8:31:47 AM6/12/14
to play-fr...@googlegroups.com

Note : On Windows (even if Play is not officially supported in production) the equivalent to /dev/null is NUL so to disable PID file you do : -Dpidfile.path="NUL"

Thanks to : https://groups.google.com/forum/#!topic/play-framework/4amD9o37Ki4

Tested with Play 2.2.1 but it should also works with current master and 2.3.x : 

https://github.com/playframework/playframework/blob/master/framework/src/play/src/main/scala/play/core/server/NettyServer.scala#L190
https://github.com/playframework/playframework/blob/2.3.x/framework/src/play/src/main/scala/play/core/server/NettyServer.scala#L190

Reply all
Reply to author
Forward
0 new messages