如何找到正在运行的 Equinox 实例的 pid,是否有 pid 文件?
如何找出正在运行的 Equinox 实例的 pid,某处是否有 pid 文件,或者它放置 pid 文件的位置是否可配置?
更新:为了说清楚,我有一堆实例正在运行,并且它们的配置大致相同,因此任何仅寻找春分的用户将不知道哪个实例是哪个
How can I find out the pid of a running equinox instance, is there a pid file somewhere or is it configurable where it places a pid file?
UPDATE: to make it clear, I have a bunch of instances running, and they are configured roughly the same, so any user only looking for equinox will not know which instance is which
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
只需从 CLI 执行以下命令:
[编辑]
Equinox 是否绑定到某个端口?
如果是这样,对于多个实例,您可以根据其绑定的端口识别您感兴趣的实例:
Just execute the following command from CLI:
[EDIT]
Does equinox bind to some port?
If so, for multiple instances you can recognize the one you are interested in basis on port to which it is bound:
不,Equinox 不会创建 PID 文件或报告其 PID。
您可以编写一个包来为您执行此操作,但请注意,Java 程序没有标准方法来检索其 PID(因为某些目标操作系统甚至没有“PID”的概念)。请参阅这篇文章了解一些想法。
No, Equinox does not create a PID file or report its PID.
You could write a bundle that does this for you, but be aware that there is no standard way for a Java program to retrieve its PID (because some target operating systems don't even have the concept of "PID"). See this post for some ideas.
来自手册页:
PIDOF(8) Linux 系统管理员手册PIDOF(8)
NAME
pidof——查找正在运行的程序的进程ID。
概要
pidof [-s] [-c] [-x] [-o omitpid] [-o omitpid..] 程序 [程序..]
描述
Pidof 查找指定程序的进程 ID (pid)。它打印
这些 id 在标准输出上。该程序在某些系统上使用
在运行级别更改脚本中,尤其是当系统具有 System-V 时
像rc结构。在这种情况下,这些脚本位于
/etc/rc?.d,在哪里?是运行级别。如果系统有启停功能
应该使用 daemon (8) 程序来代替。
选项
-s Single shot - 这指示程序仅返回一个 pid。
-c 只返回以相同根运行的进程 ID
目录。非 root 用户会忽略此选项,因为他们
将无法检查进程的当前根目录
他们不拥有。
-x 脚本太 - 这会导致程序也返回进程
运行指定脚本的 shell 的 id。
-o 省略pid
告诉 pidof 忽略具有该进程 ID 的进程。特别的
pid %PPID 可以用来命名pidof的父进程
程序,换句话说,调用 shell 或 shell 脚本。
退出状态
0 至少找到一个具有所请求名称的程序。
1 未找到具有请求名称的程序。
From the man page:
PIDOF(8) Linux System Administrator's Manual PIDOF(8)
NAME
pidof -- find the process ID of a running program.
SYNOPSIS
pidof [-s] [-c] [-x] [-o omitpid] [-o omitpid..] program [program..]
DESCRIPTION
Pidof finds the process id's (pids) of the named programs. It prints
those id's on the standard output. This program is on some systems used
in run-level change scripts, especially when the system has a System-V
like rc structure. In that case these scripts are located in
/etc/rc?.d, where ? is the runlevel. If the system has a start-stop-
daemon (8) program that should be used instead.
OPTIONS
-s Single shot - this instructs the program to only return one pid.
-c Only return process ids that are running with the same root
directory. This option is ignored for non-root users, as they
will be unable to check the current root directory of processes
they do not own.
-x Scripts too - this causes the program to also return process
id's of shells running the named scripts.
-o omitpid
Tells pidof to omit processes with that process id. The special
pid %PPID can be used to name the parent process of the pidof
program, in other words the calling shell or shell script.
EXIT STATUS
0 At least one program was found with the requested name.
1 No program was found with the requested name.