What is a .pid file and what does it contain?

前端 未结 3 1058
-上瘾入骨i
-上瘾入骨i 2020-11-28 01:27

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

A Pid-File is a file conta

相关标签:
3条回答
  • 2020-11-28 01:48

    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

    0 讨论(0)
  • 2020-11-28 01:51

    Pidfile contains pid of a process. It is a convention allowing long running processes to be more self-aware. Server process can inspect it to stop itself, or have heuristic that its other instance is already running. Pidfiles can also be used to conventiently kill risk manually, e.g. pkill -F <some.pid>

    0 讨论(0)
  • 2020-11-28 02:01

    To understand pid files, refer this DOC

    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.

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

    0 讨论(0)
提交回复
热议问题