The problem here that I can see, from the code snippet provided is the path being passed to the open statement. The normal behaviour of Proc::Daemon as part of the initialisation process is to chdir to the root directory - This will greatly impact upon your script if relative paths are being used. The most likely thing that is happening here is that your script, finding itself in the root directory, cannot open the file FDserv.p and is ceasing execution. The reason why this is not returning an error to your screen from the die statement is because all open filehandles, including STDOUT, STDIN and STDERR, are closed by Proc::Daemon - Note that other things such as user permissions may also play a role at this point.
This brings me to another point - As the standard filehandles are closed as part of the initialisation process of Proc::Daemon, it is necessary to incorporate another means of error reporting, such as the system log or a dedicated application log file, as opposed to reporting errors to STDERR - This step alone should help you determine the cause of the error at hand.
Update - If the main role at hand is to manipulate a PID file, then the module Proc::PID::File may also be of interest.
In reply to Re: Daemonize and open a file
by rob_au
in thread Daemonize and open a file
by JamieD
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |