Restarting Mysql and Apache Using Cron Job

Have you notice that your RAM usage on your server is very close to your memory installed? It’s possible because of memory leaking and resource hogging web application. You can free your RAM by restarting Apache and MySQL.

I will give you step by step adding cron jobs into your system:

  1. Login to your server with SSH
  2. Type crontab -l to display list of cron jobs,
  3. Type crontab -e to edit your crontab,
  4. Add * 4 * * * /etc/init.d/mysqld restart to restart Mysql everyday at 4 AM,
  5. Add * 5 * * * /etc/init.d/httpd restart to restart Apache everyday at 5 AM,
  6. Save your file,
  7. Recheck with crontab -l
Advertisements

One comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s