我最近遇到了一个扩展名为 .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 文件中包含的内容的详细信息?
最佳答案
pid 文件包含给定程序的进程 ID(一个数字)。例如,Apache HTTPD 可能将其主进程号写入 pid 文件——这是一个常规文本文件,仅此而已——然后使用其中包含的信息来停止自身。您还可以使用该信息自行终止进程,使用 cat filename.pid | xargs 杀死
https://stackoverflow.com/questions/8296170/