I want to write a robust daemon in perl that will run on Linux and am following the template described in this excellent answer. However there are a few differences in my situation: First I am using Parallel::ForkManager start() and next
; to fork on an event immediately followed by exec('handle_event.pl')
In such a situation, I have the following questions:
- Where should I define my signal handlers. Should I define them in the parent (the daemon) and assume that they will be inherited in the children?
- If I run
exec('handle_event.pl')
will the handlers get inherited across the exec (I know that they are inherited across thefork
)? - If I re-define a new signal handler in
handle_event.pl
will this definition override the one defined in the parent? - What are best practices in a situation like this?
Thank you