Linux Server has implemented a memory management efficiently and even more than that, but if any process is taking more our memory and we want to clear it, Linux provides a way to flush or clear ram cache.
Here is we prepare a schedule to clear memory cache in Linux Server:
Step1: Create a shell script name as "clearcache.sh" under root (/root) partition with following commands
sync; echo 3 > /proc/sys/vm/drop_caches
Step2: Set the permission of "clearcache.sh" script to 755
# chmod 755 /root/clearcache.sh
Step3: Edit the system crontab file using below command
# crontab –e
Step4: Enter the following line in crontab file to set cron job for clearing cache automatically
0 0 * * 0 /root/clearcache.sh
Append the above line, it is ruing at 00:00 every week.
Step4: Restart cron service to make it effect