Ken Perl wrote:
> I add your code to my startup.pl, but it doesn't work.

Change 'print' to warn and you should see the expected behaviour.

The only exception is stop, that doesn't go thru a restart cycle, so the
correct way to detect a shutdown is to register a server_shutdown callback
like this :

Apache2::ServerUtil::server_shutdown_cleanup_register(sub { warn "I am shutting 
down" });

> # apache2ctl -k start
> Program is starting
> Stopping...
> 
> #apache2ctl -k graceful
> <no output here>
> 
> # apache2ctl -k stop
> <no output here>
> 
> On 2/13/06, Frank Wiles <[EMAIL PROTECTED]> wrote:
> 
>>On Mon, 13 Feb 2006 09:17:57 +0800
>>Ken Perl <[EMAIL PROTECTED]> wrote:
>>
>>
>>>No, I want to do something in the startup.pl script.
>>>When apache start, I also want to say my modperl program is starting
>>>and started, when stop, I want to say my modperl program is stopping
>>>and stopped. When graceful, I want to say reloading and reloaded.
>>>But I didn't find a API could help, any ideas?
>>
>> Hi Ken,
>>
>> I haven't tested this, but it should work. In your startup.pl do
>> something like this:
>>
>> my $started = 0;
>> my $cnt = Apache2::ServerUtil::restart_count();
>>
>> if( !$started and $cnt == 1 ) {
>>      $started = 1;
>>      print "Program is starting\n";
>> }
>>
>> if( $cnt > 2 ) {
>>      print "Restarting";
>> }
>>
>> if( $started and $cnt == 1 ) {
>>      print "Stopping...";
>> }
>>

--------------------------------------------------------------------------------
Philippe M. Chiasson m/gozer\@(apache|cpan|ectoplasm)\.org/ GPG KeyID : 88C3A5A5
http://gozer.ectoplasm.org/     F9BF E0C2 480E 7680 1AE5 3631 CB32 A107 88C3A5A5

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to