Clear cached memory on cpanel server

By default the Linux OS is very efficient memory management process that should be freeing any cached memory on the machine that it is being run on. However when it comes to Cached memory the Linux OS may at times decide that the Cached memory is being used and is needed which can lead to memory related issues.

You can use the following command to flush your cache memory

[email protected] [~]# echo 1 > /proc/sys/vm/drop_caches

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.

create file to clear cache memory

vi /root/clearcache.sh

and paste the following commands.

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

save and add this script in your cron job.

0 * * * * /root/clearcache.sh

Thats all.. This script will remove cached memory automatically after every hour.

 

4.30 avg. rating (84% score) - 10 votes
Website Pin Facebook Twitter Myspace Friendfeed Technorati del.icio.us Digg Google StumbleUpon Premium Responsive