Clear cached memory on cpanel server

Flushing the Cached Memory
By default, Linux has a very efficient memory management process that should be freeing any cached memory on the server. However, the server may, at times, decide that the cached memory is needed but is being used which can lead to memory related issues.

You can use the following command to flush your cache memory

root@server [~]# echo 1 > /proc/sys/vm/drop_caches

Setup Cron to Remove Cached Memory
In order to remove cached memory on every hour the cron job will run this command and clear any memory cache that has built up. To create the script:

vim /root/clearcache.sh

then paste the following entry:.

#!/bin/sh
sync; echo 3 > /proc/sys/vm/drop_caches

the save and add this script in your cron job.

0 * * * * /root/clearcache.sh

Thats it. The cron’d script will remove cached memory automatically every hour.

g33kadmin

I am a g33k, Linux blogger, developer, student and Tech Writer for Liquidweb.com/kb. My passion for all things tech drives my hunt for all the coolz. I often need a vacation after I get back from vacation....

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.