środa, 5 października 2011

Apache restart using crontab

If you have problem with your Apache server (for example when your server hang from time to time)this may be associated with too many apache processes. If the server crashes from time to time it is a hassle for you and your Customer.
You can add RAM to your server, but not sure if this will solve the problem.
A better method is to add the crontab job that will restart the Apache process (You should also upgrade your Apache version).
Download Video Tutorial
Let's start:
- login as root to your apache server (you can use ssh, direct access, webmin etc.)
- type crontab -e to edit crontab
That will put you in the Vi editor editing your crontab. The Vi keystrokes you need to edit your crontab are: "i" for insert (or insert key), then type out your cron line following the format below , then press the "escape" key on your keyboard to get out of insert mode, then ":" to get a prompt, then "wq" and then "enter" and it is saved.
- in the last line type
5 0 * * * /etc/init.d/httpd restart >/dell/null 2>&1
Run at 5 minutes after midnight, every day (restart apache)
- save crontab esc : wq! and exit
it's all
ps. if you start Apache using then type in crontab
5 0 * * * /usr/local/apache/bin/apachectl restart
or 5 0 * * * /usr/sbin/apachectl restart

Brak komentarzy:

Prześlij komentarz