Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re^2: A perl daemon

by clinton (Priest)
on Jan 21, 2009 at 10:10 UTC ( #737792=note: print w/replies, xml ) Need Help??


in reply to Re : A perl daemon
in thread A perl daemon

For handling signals, have a look at perlipc, especially the section entitled Handling the SIGHUP Signal in Daemons.

You probably want something like this (untested):

sub reload_cron { my $cron = shift; my $file = shift; $cron->clean_timetable; $cron->load_crontab($file); } { local $SIG{USR1} = sub { reload_cron($cron,$file) }; $cron->run; }
Then to signal the cron daemon, you need it's PID, and you can do:
kill $pid,10; # SIGUSR1

Hope this helps>

Replies are listed 'Best First'.
Re^3: A perl daemon
by trm (Novice) on Jan 21, 2009 at 18:26 UTC
    Thank you again for the information. I'll take a look at the module. I think the explanation is a bit beyond my grasp, but hopefully with the module docs that will clear up my confusion.

    I did try the nofork alternative, which I thought would be appropriate as I am using a governed queue with my application, and a fork could potentially effect it. However, it seems that if I have multiple schedules at the same time, only one schedule (somewhat random choice) will execute. I imagined that one would execute, then the next would execute, followed by however many are waiting to process. Any experience with the nofork mode that you might shed some light on?

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://737792]
help
Chatterbox?
[Corion]: hippo: Yeah, but at least two years ago, it still was close enough to 20% cut
[Corion]: But I have a very positive experience with a four day workweek and a three day weekend. I can't easily go back though to full money.
[Corion]: That is easy without having to pay for a house, a wife or children though. If I had any of these, or any two of these, the decision wouldn't be that easy.
[ambrus]: wait. I understand no wife and children, but how do you not have to pay for a house?
[hippo]: I had a low-paid job about 20 years ago and seriously considered going down to a 3-day week. Would have worked 60% of the time for about 80% of the cash.
[Corion]: ambrus: Well, I pay rent, but don't own a house with variable/ unforeseeable costs
[hippo]: The thesholds/benefits balance at the time was nuts.

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (11)
As of 2017-09-21 15:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    During the recent solar eclipse, I:









    Results (249 votes). Check out past polls.

    Notices?