Re: How to re-"use Module" if the Module has changed?



andrew.fabbro@xxxxxxxxx wrote:
> What I'd like to do is have the module reread its config if it gets a
> HUP signal. But how can I say "go and 'use Module' again"? It appears
> that if you 'use Module' more than once, subsequent calls are ignored.

>>From the Perl Cookbook:

17.16. Restarting a Server on Demand

Problem
You want your server to shutdown and restart when it receives
a HUP signal, just like inetd or httpd .

Solution
Catch the SIGHUP signal, and re-execute your program:

$SELF = "/usr/local/libexec/myd"; # which program I am
@ARGS = qw(-l /var/log/myd -d); # program arguments

$SIG{HUP} = \&phoenix;

sub phoenix {
# close all your connections, kill your children, and
# generally prepare to be reincarnated with dignity.
exec($SELF, @ARGS) or die "Couldn't restart: $!\n";
}

-jp

.



Relevant Pages

  • Re: How to re-"use Module" if the Module has changed?
    ... >> What I'd like to do is have the module reread its config if it gets a ... >> From the Perl Cookbook: ... config params. ... --Perl Consulting, Stem Development, Systems Architecture, Design and Coding- ...
    (comp.lang.perl.misc)
  • Re: [git patches] 2.6.x net driver updates
    ... Then use '/' to search for the CONFIG_ symbols to see where they are ... More majordomo info at http://vger.kernel.org/majordomo-info.html ... Please read the FAQ at http://www.tux.org/lkml/ ... Prev by Date: ...
    (Linux-Kernel)
  • Re: outlook express
    ... > please help I have error message for outgoing - host server not found SMTP ... > tried config - not helped = chris ... Prev by Date: ...
    (microsoft.public.windowsxp.general)
  • Re: 3g signal
    ... >> It's not a hidden menu, somewhere in Settings or Config on nearly any ... Steve ... Prev by Date: ...
    (uk.telecom.mobile)
  • Re: Server publishing
    ... Well, I decided once more to clean my config and start afresh, only ... Best regards, ... Prev by Date: ...
    (microsoft.public.isa.configuration)