问题
I closed the terminal window by mistake and I don't know the PID of the running Play process. How to find it? Or, where is the RUNNING_PID file?
I am using Play 2.4.6 and running in non-production mode (activator run
).
回答1:
When using dev mode (activator run
), no RUNNING_PID
file is generated. The process won't detach and will be killed when the terminal is closed.
By default the RUNNING_PID
file is written to ./target/universal/stage/RUNNING_PID
(inside the project's root directory) when using production mode.
So, to kill the process (from the project directory), you can:
$ kill $(cat target/universal/stage/RUNNING_PID)
You can also change the configuration variable pidfile.path
to write the file to where ever you want, as long as the Play application has the correct write permissions.
For example:
pidfile.path=/var/run/play.pid
Or as a command line argument (for a staged binary):
$ target/universal/stage/bin/myapp -Dpidfile.path=/var/run/play.pid
回答2:
I only want to add that there is a command comes with Activator (for Play 2.4+) which kill/stop process (in a kind of nice way).
Activator stopProd
Here is a screenshot of how it looks
来源:https://stackoverflow.com/questions/34829549/how-to-kill-a-play-framework-process