Take the 2-minute tour ×  I often see that programs specify pid
and lock files. And I'm not quite sure what they do.  For
example, when compiling nginx:  --pid-path=/var/run/nginx.pid \
Can somebody shed some light on this one?  share|improve this
question add comment  migrated from serverfault.com May 7 '11 at
20:41   3 Answers  up vote 15 down vote accepted  pid files are
written by some programs to record their process ID while they
are starting. This has multiple purposes:    • It's a signal to
other processes and users of the system that that particular
program is running, or at least started successfully.   • It
allows one to write a script really easy to check if it's
running and issue a plain kill command if one wants to end it.
• It's a cheap way for a program to see if a previous running
instance of it did not exit successfully.  Mere presence of a
pid file doesn't guarantee that that particular process id is
running, of course, so this method isn't 100% foolproof but
"good enough" in a lot of in