Crontab - Restart apache every 3 hours [closed] Crontab - Restart apache every 3 hours [closed] apache apache

Crontab - Restart apache every 3 hours [closed]


Why do you want to do this?If you are experiencing a specific problem with Apache.It Will definitely be more beneficial for you to have a look into the access/error logs, and make adjustments accordingly.Give us some more information and we can look into your logs and give you a more appropriate solution.

None the less heres the cron to restart apache.

0 */3 * * */ root/restart_apache > /dev/null 2>&1

/etc/init.d/httpd restart


I can almost guarantee this 'fix' will not address your real issue. Why not post your Http.conf settings and a little info on your server resources (memory, cpus) and we might help fix your config issues.


Instead of adding to the crontab of an individual user (root), I would add hacks like this to /etc/cron.d.

Change 'apache2' to whatever the init script is on debian.

echo '* */3 * * * root /etc/init.d/apache2 restart 2>&1 >/dev/null' > /etc/cron.d/apachesux