Mark_H
Mark_H

Reputation: 790

How to run play framework 2.5 in background (as a daemon)?

In play 2.1, I use "play start" and then "ctrl + D"

In play 2.3.x, it is activator start & ctrl +D

But in play 2.5.x, activator start will be deprecated.

The document says that we can run the production mode as below:

`$ activator clean stage
$ target/universal/stage/bin/my-first-app -Dplay.crypto.secret=abcdefghijk`

But it would stuck and ctrl+d is not working anymore. So I have to use nohup command to run my application. Anyone knows how to run play framework 2.5 in background as before?


Edit: Now I use "nohup target/universal/stage/bin/prj-name > app.log & " to start my server. But the log format is totally wrong like [^[[37minfo^[[0m] application -... instead of 2016-11-09 03:05:01,157 [INFO] from application in pool-6-thread-4 - Application... The later one is the correct format when I start my server by "activator start".

Upvotes: 2

Views: 2483

Answers (1)

Neil_TW
Neil_TW

Reputation: 97

You can try

Compile:

./activator stage -java-home /Library/Java/JavaVirtualMachines/jdk1.8.0_20.jdk/Contents/Home

Start:

target/universal/stage/bin/serivce_app -Dhttp.port=8080 -Dconfig.file=conf/stage.conf -java-home /Library/Java/JavaVirtualMachines/jdk1.8.0_20.jdk/Contents/Home &

Upvotes: 0

Related Questions