kill -s USR2 {process id}
see: man kill
see also: man killall
This is just one way to handle it. It, of course, requires that you
manually send the signal to the process when your data file has changed.
Using this method eliminates the need to stat() the datafile with each
request to see if it has changed. You surely will not want to base your
stat on -M, as that will certainly vary over time. Instead, you'd want to
base on (stat)[9]. Remember though, this will have the overhead of
stat()ing the file with each FETCH(), but at least it won't have the
overhead of loading and parsing the file with each request.
For example:
package My::AutoData;
use strict;
use vars qw($MOD_TIME,$DATA_FILE,%DATA);
$DATA_FILE = "/path/to/data/file.dat";
$MOD_TIME = (stat($DATA_FILE))[9];
sub FETCH {
load_data() unless %DATA;
load_data() if ($MOD_TIME != (stat($DATA_FILE))[9]);
# continue with code to return requested data
}
sub load_data {
# insert code to parse data file and assign to global %DATA
}
1;
__END__
I am assuming this would work, I've not tested it.
Thanks,
Tim Tompkins
----------------------------------------------
Staff Engineer / Programmer
http://www.arttoday.com/
----------------------------------------------
----- Original Message -----
From: "Morbus Iff" <[EMAIL PROTECTED]>
To: "G.W. Haywood" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Wednesday, May 09, 2001 2:14 PM
Subject: Re: mod_perl and 700k files...
> >> Ahhh. Ok. What's this $SIG{'USR2'} thingy. What's that do?
> >
> >http://perl.apache.org/guide
>
> Well, that's all fine and dandy, and I've gone through there before, but
> the only thing the search engine brings up concerning USR2 is:
>
> >The above code asigns a signal handler for the USR2 signal.
> >This signal has been chosen because it's least likely to be
> >used by the other parts of the server.
>
> That, unfortunately doesn't tell me what causes a USR2 signal to be sent
to
> Apache. Or when it's caused. I only want to reload the file when said file
> has changed. Am I supposed to do some checking against the file -M time
> myself, and then send a USR2 signal myself?
>
>
> Morbus Iff
> .sig on other machine.
> http://www.disobey.com/
> http://www.gamegrene.com/
>
>