in reply to Re^2: Apache restart
in thread Apache restart
if, as wise Marshall said, if your are the Anonymous Monk who run Apache on windows you can follow the Marshall advice about on fail service configuration, or you can create a Perl wrap around some windows commands.
See SC and NET (service) commands.
This can be something to start with (UNTESTED!!):
# the Apache checker is running forever while (1){ my $status # put here the right name of the Apche ser +vice open my $check, "sc query W32Time|" or die "unable to run the check. +."; while (<$check>){ if ($_ =~ /STATUS\s+:\s(\d\s\w+)$/){ $status = $1; last; } } close $check; print scalar localtime(time), " Apache is in the state: ",$status,"\ +n"; unless ($status eq '4 RUNNING'){ print "Apache is not running! Trying a restart\n"; open my $start, 'NET START "W32Time"|' or die "Unable to attemp +t restart!"; print while <$start>; # add more actions: mail, event write... } sleep 60; # or another reasonable amount of time.. }
HtH
L*
|
|---|