 <p>One common solution is to create a pid file somewhere. If the pid file exists, exit the process early. Otherwise create the pid file (writing <code>process.pid</code> to it) and delete it when the process exits.</p>