This software manages a pid file for you. It will create a pid file, query the process within to discover if it's still running, and remove the pid file. WWW: https://metacpan.org/release/File-Pid