Log in |
Monitoring and Restarting ZopeThis Perl script is Windows specific. There are times when your Zope is just not working correctly. Here is a simple way to monitor your Zope. It asks for a HEAD from the server at $url every $delay seconds. When it can't get a response, it restarts the service. use LWP::Simple; use Win32::Service; my $machine = 'Server'; my $service= 'Zope'; my $file='d:\logs\zope.log'; my $url = 'http://Server'; my $delay = 30; while (1) { &test; sleep $delay; } sub test { if (!head($url)) { open(LOG, ">>$file"); print LOG "**********Down\n"; print LOG scalar(localtime), "\n"; close LOG; &restart; } else { print "ok\n"; } } sub restart { Win32::Service::StopService($machine,$service); Win32::Service::StartService($machine,$service); } |