I am unclear on the need and the usage of a pid-file and I wanted to know what is the correct usage of a pidfile and what are the best practices surrounding it.
+1
A:
in linux, typically in /var/run there are pidfiles listed for all currently running processes and they contain, obviously, the process id. so when you use commands like ps aux, and they list the process id (PID) as a column, you may use them as a base of comparison
David
2010-04-13 14:57:05
It is not all currently running processes - it is usually only daemon processes, of which it only makes sense for one to be running. Additionally, for daemons that fork long-running child processes (like Apache), the pidfile might only contain the pid of the "head" process.
caf
2010-04-14 01:51:15