Portal Home > Knowledgebase > Articles Database > How can I set cron to restart apache every 15 minutes?

How can I set cron to restart apache every 15 minutes?

Posted by chasebug, 12-13-2010, 09:34 AM
Also need for every 1 hour.

Posted by fabin, 12-13-2010, 10:06 AM
Why do you want to do this?

Posted by OLM | DavidG, 12-13-2010, 10:19 AM
Restarting Apache in this manner will interrupt services and should be avoided. If you are experiencing a specific problem with Apache, it will be more beneficial for you to review the access/error logs, and make adjustments accordingly. If you can post more details about the problem you are (apparently) experiencing, someone here may be able to help you with such adjustments.

Posted by LVPSHosting, 12-13-2010, 10:37 AM
There are a lot of scripts you can find all over the internet which will monitor your apache service and if it is down will be restarted automatically, if that is what you want to accomplish.

Posted by tt2020, 12-13-2010, 03:38 PM
http://www.rfxn.com/projects/system-integrity-monitor/ Service monitoring of HTTP, FTP, DNS, SSH, MYSQL

Posted by chasebug, 12-13-2010, 06:19 PM
Server is experiencing high load (6-10) and I find that restarting Apache will drop the load back to (1-2). So I want to keep restarting it automatically.

Posted by quad3datwork, 12-13-2010, 06:21 PM
Have you looked into why Apache is causing high load? Restarting a service because of high load does not solve the root problem.

Posted by LnxtecH, 12-13-2010, 11:06 PM
As others pointed out, I would also suggest to find out the root cause. However if you need to add a cronjob, use below Add the entries below to the file /root/restart_apache and chmod it to 755 Note: Use command 'crontab -e' to edit the crontab.

Posted by luisifer, 12-14-2010, 12:13 AM
This article might help you. http://www.richardtoh.com/how-to-res...using-cron-job But restarting Apache just temporary reduce the load, it wont solve the problem to the root.

Posted by kevinnivek, 12-14-2010, 05:46 PM
yeah -- restarting apache will close/reset all currently open connections. this will interrupt your sites. its not a generally accepted best practice to do this by any means.

Posted by plumsauce, 12-14-2010, 09:09 PM
Of course it drops the load. By restarting you interrupt a bunch of connections. Another vote for figuring out the cause of the problem and not burying it with restarts.

Posted by raffo, 12-22-2010, 09:24 PM
Well try just to flush memory cache, not to restart each time apache. # sync ; echo 3 > /proc/sys/vm/drop_caches

Was this answer helpful?

Add to Favourites Add to Favourites    Print this Article Print this Article

Also Read

Powered by WHMCompleteSolution


Customer Testimonials

John Doe
It's a great service with fantastic support. It's definately good value for your money. Overall rating, 10 out of 10.
Mike Smith
Much better than my previous hosting company - I also got help with migration at no extra cost. Friendly support too.
Copyright © 2015 DC International LLC in partnership with Bragin IT Solutions Inc. - All Rights Reserved.