Skip to main content
3 of 3
edited body; edited tags
Jeff Schaller
  • 68.8k
  • 35
  • 122
  • 264

How to write a shell script restart apache if `server reached MaxClients`

Recently, my blog always shutdown, it use centos6.2+apache2.2+mysql5.5+php5.3. I have raised MaxClients in httpd.conf, but less useful.

So is it possible to write a shell script (Run with crontab every 10 minutes), to read the httpd/error_log, if the last message preg_match sending a SIGTERM do restart apache automatically?

yuli chika
  • 399
  • 3
  • 5
  • 9