Possible Duplicate:
Reference for proper handling of PID file on Unix
Is the .pid file in unix created automatically by the operating system whenever a process runs OR should the process create a .pid file programmatically like “echo $$ > myprogram.pid” ?
The latter holds true — a process must create the .pid file (the OS won’t do it).
pidfiles are often used by daemon processes for various purposes. For example, they can be used to prevent a process from running more than once. They can also be used so that control processes (e.g.apache2ctl) know what process to send signals to.