如何杀死 Play Framework 进程? [英] How to kill a Play Framework process?

查看:56
本文介绍了如何杀死 Play Framework 进程?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我错误地关闭了终端窗口,我不知道正在运行的 Play 进程的 PID.如何找到它?或者,RUNNING_PID 文件在哪里?

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?

我使用的是 Play 2.4.6 并在非生产模式下运行 (activator run).

I am using Play 2.4.6 and running in non-production mode (activator run).

推荐答案

当使用开发模式 (activator run) 时,不会生成 RUNNING_PID 文件.该进程不会分离,并会在终端关闭时被终止.

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.

默认情况下,RUNNING_PID 文件在使用生产模式时写入 ./target/universal/stage/RUNNING_PID(在项目的根目录内).

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)

您还可以更改配置 变量 pidfile.path 将文件写入任何您想要的位置,只要 Play 应用程序具有正确的写入权限即可.

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.

例如:

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

这篇关于如何杀死 Play Framework 进程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆