Better than before, but only 'start' works. debian:~/WebGUI# apache2ctl -k start [Fri Feb 17 22:34:21 2006] preload.perl: Program is starting Loading WebGUI.conf debian:~/WebGUI# apache2ctl -k graceful [Fri Feb 17 22:34:55 2006] preload.perl: Program is starting Loading WebGUI.conf [Fri Feb 17 22:34:57 2006] -e: I am shutting down at /root/WebGUI/sbin/preload.perl line 33. debian:~/WebGUI# apache2ctl -k stop [Fri Feb 17 22:35:28 2006] preload.perl: Program is starting Loading WebGUI.conf [Fri Feb 17 22:35:29 2006] -e: I am shutting down at /root/WebGUI/sbin/preload.perl line 33.
On 2/17/06, Philippe M. Chiasson <[EMAIL PROTECTED]> wrote: > 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 > > > -- perl -e 'print unpack(u,"62V5N\"FME;G\!E<FQ`9VUA:6PN8V]M\"[EMAIL PROTECTED] ")'