什么是。pid文件,它包含什么?

时间:2022-05-31 14:06:32

I recently come across a file with the extension .pid and explored inside it but didn't find much. The documentation says:

我最近遇到了一个扩展名为.pid的文件,并在其中进行了探索,但没有发现太多。文档表示:

A Pid-File is a file containing the process identification number (pid) that is stored in a well-defined location of the filesystem thus allowing other programs to find out the pid of a running script.

pid - file是一个包含进程标识号(pid)的文件,它存储在文件系统的定义良好的位置,从而允许其他程序查找正在运行的脚本的pid。

Can anyone shed more light on this, or guide me to details of what's contained in the pid file?

有谁能更清楚地说明这一点,或者引导我了解pid文件中包含的内容的细节吗?

2 个解决方案

#1


174  

The pid files contains the process id (a number) of a given program. For example, Apache HTTPD may write its main process number to a pid file - which is a regular text file, nothing more than that - and later use the information there contained to stop itself. You can also use that information to kill the process yourself, using cat filename.pid | xargs kill

pid文件包含给定程序的进程id(数字)。例如,Apache HTTPD可以将它的主进程号写入pid文件——这是一个普通的文本文件,仅此而已——然后使用其中包含的信息来停止自己。您还可以使用cat文件名使用这些信息来杀死进程。pid | xargs杀死

#2


1  

To understand pid files, refer this DOC

要了解pid文件,请参考此文档

Some times there are certain applications that require additional support of extra plugins and utilities. So it keeps track of these utilities and plugin process running ids using this pid file for reference.

有些时候,某些应用程序需要额外的插件和实用程序的支持。因此,它使用这个pid文件跟踪这些运行id的实用程序和插件进程。

That is why whenever you restart an application all necessary plugins and dependant apps must be restarted since the pid file will become stale.

这就是为什么无论何时重新启动应用程序,都必须重新启动所有必需的插件和依赖的应用程序,因为pid文件将变得陈旧。

#1


174  

The pid files contains the process id (a number) of a given program. For example, Apache HTTPD may write its main process number to a pid file - which is a regular text file, nothing more than that - and later use the information there contained to stop itself. You can also use that information to kill the process yourself, using cat filename.pid | xargs kill

pid文件包含给定程序的进程id(数字)。例如,Apache HTTPD可以将它的主进程号写入pid文件——这是一个普通的文本文件,仅此而已——然后使用其中包含的信息来停止自己。您还可以使用cat文件名使用这些信息来杀死进程。pid | xargs杀死

#2


1  

To understand pid files, refer this DOC

要了解pid文件,请参考此文档

Some times there are certain applications that require additional support of extra plugins and utilities. So it keeps track of these utilities and plugin process running ids using this pid file for reference.

有些时候,某些应用程序需要额外的插件和实用程序的支持。因此,它使用这个pid文件跟踪这些运行id的实用程序和插件进程。

That is why whenever you restart an application all necessary plugins and dependant apps must be restarted since the pid file will become stale.

这就是为什么无论何时重新启动应用程序,都必须重新启动所有必需的插件和依赖的应用程序,因为pid文件将变得陈旧。