Web Hosting Talk







View Full Version : restarting apache after error in log


Lmax
03-03-2002, 08:47 AM
Is it possible to let a crontab look in the apache error docs and if it finds an expression in the last 100 lines or so it will it will restart apache.
Anyone know if this is possible??

Thanks

Tim Greer
03-03-2002, 11:16 AM
Originally posted by Lmax
Is it possible to let a crontab look in the apache error docs and if it finds an expression in the last 100 lines or so it will it will restart apache.
Anyone know if this is possible??

Thanks

Yes, of course it's possible. There's also a few ways to do it. Finding an error and restarting Apache though, seems confusing. Why would it need to restart it, if it's already running? A better idea might be to have it check if Apache is running, and if not, then start it. An automated task can't usually, or easily manage to fix an error and then restart it, but it might be worth a try -- but I'd think finding the cause to prevent such a thing would be a better idea. Perhaps I don't understand why you want to do this?

Lmax
03-03-2002, 11:28 AM
In my logs sometimes appear these errors
[notice] child pid 21706 exit signal Segmentation fault (11)

They seem to affect the performance of apache. A restart normally solves the problem.

ANy suggestions on what may cause these errors and what to do with them are also welcome

Tim Greer
03-03-2002, 11:46 AM
That is likely caused by a PHP script making an MySQL call on someone's site (or actually a lot of PHP calls can cause this, not just an MySQL call, that's just the most common from what I've seen -- it's also possible it's not having to do with PHP, but I'd bet it is.). Did you notice any other errors at all around the time of those? Also, check to cross reference the time/date of the error with any of the logs for Apache as well as the user's domain logs, if those are separate. You can create a cron job to grep the error log for this error and restart Apache, sure, but then remember to make sure that it's not a previous error. I.e., the log isn't 100 lines longer and you check the last 100 lines for this error, it'll find it again, and again and again. So, you'll have to make sure the date is within the time it checks. Also, check to see if there's a core dump anywhere, especially in the Apache directory, it might tell you what happened.

NoComment
03-05-2002, 01:05 AM
Segmentation Fault (11) might be a sign of bigger trouble. Namely your RAM might be going bad. If it keeps happening, I would recommend that you have your RAM replaced.

*NoComment*