title: Writing PID File on Linux
body: <p>I am currently working on a linux daemon that needs to be single instance (i.e restricted to 1 user 1 process). What would be the best way of doing so without having to use <code>getpid()</code> to manually write the pid out to <em>/var/run/</em> and then lock it using <code>flock()</code>? </p>