I have a daemon I have written using Python. When it is running, it has a PID file located at /tmp/filename.pid. If the daemon isn\'t running then PID file doesn\'t exist.
The other answers are fine for detecting the existence of the file. However for a complete solution you probably should check that the PID in the pidfile is still running, and that it's your program.