How to kill a Play Framework process?

拜拜、爱过 提交于 2021-01-28 12:31:52

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!