I'm working on a daemon for some asynchronous processing and I'm using Proc::PID::File to check if the daemon is already running, as suggested here.
My problem boils down to the creation of the pid file. The following simple code:
die "Already running!" if Proc::PID::File->running();
produces the following error:
pid "/var/run/proc_pid.pl.pid" already locked: Bad file descriptor
I guess this is due to permissions because I can solve it by pointing Proc::PID::File to a different directory:
die "Already running!" if Proc::PID::File->running(dir=>"/my/home/dir"
This works fine and if I use that in my daemon script it also works and "ps" also lists it fine.
My main question is: is there a problem with putting pid files in non-standard locations?
Thanks for your help!