PID file and lock
Create and lock a PID file. If the PID file exists and is locked, an exception is thrown. To use, simply call this function at the top of main to prevent multiple instances.
The default name argument for createPidFile. Returns a file name containing the username and program name.
The default path argument for createPidFile. Returns "/var/run" if running as root on POSIX, or the temporary directory otherwise.
The PID file. Kept open and locked while the program is running.