Reload Childs..

Mike Kercher mike at CAMAROSS.NET
Thu Oct 30 19:12:31 GMT 2003


Isn't that what 'service MailScanner reload' accomplishes?

Mike


> -----Original Message-----
> From: MailScanner mailing list
> [mailto:MAILSCANNER at JISCMAIL.AC.UK] On Behalf Of Sebastian Wiesinger
> Sent: Thursday, October 30, 2003 12:09 PM
> To: MAILSCANNER at JISCMAIL.AC.UK
> Subject: Reload Childs..
>
> Hi.. I thought about reloading MailScanner Config without
> having to restart it and made this little hack. I copied the
> ExitParent sub to ExitChilds, removed the exit 0 and set it
> as the signal handler for HUP in the parent process. This
> kills all childs and the parent will recreate them. Well, it
> works for me...
>
> --- ./MailScanner.org/bin/MailScanner   Mon Oct  6 10:02:18 2003
> +++ ./MailScanner/bin/MailScanner       Thu Oct 30 18:59:22 2003
> @@ -86,7 +86,7 @@
>  delete $ENV{'HOME'};
>
>  # Need the parent process to ignore SIGHUP, and catch
> SIGTERM -$SIG{'HUP'} = 'IGNORE';
> +$SIG{'HUP'} = \&ExitChilds;
>  $SIG{'TERM'} = \&ExitParent;
>
>  # Remember to update this before releasing a new version of
> MailScanner.
> @@ -528,6 +528,23 @@
>    exit 0;
>  }
>
> +sub ExitChilds {
> +  my($sig) = @_; # Arg is the signal name
> +  my($child, @dirlist);
> +
> +  #print STDERR "Killing child processes...\n";  kill 1, keys
> + %Children;  sleep 3; # Give them time to die peacefully
> +
> +  # Clean up after the dying processes in case they left a mess.
> +  foreach $child (keys %Children) {
> +    #push @dirlist, "$WorkDir/$child" if -d "$WorkDir/$child";
> +    rmtree("$WorkDir/$child", 0, 1) if -d "$WorkDir/$child";  }
> +
> +  #system($global::rm . " -rf \"" . join("\" \"", @dirlist) . "\"")
> +  #  if @dirlist;
> +}
>
>  #
>  # Start logging
>
>
>
> Sebastian
> --
> InterNetX GmbH
> Sebastian Wiesinger
> System Administration
> Maximilianstrasse 6
> D-93047 Regensburg
>
> Tel. +49 941 59559-0
> Fax  +49 941 59559-245
>
> eMail: sebastian.wiesinger at internetx.de
> GPG-Key: 0x97F5A1D8 (0x8431335F97F5A1D8)
>



More information about the MailScanner mailing list