web analytics

Geeks Terminal

          Linux | Open Source | Web Hosting and more..

Linux logo

To clear cache memory use  following command as user root

sync; echo 3 > /proc/sys/vm/drop_caches

 

To set cronjob to clear cache memory at specific intervals

  • Access server through shell as root user.
  • First we will create a shell script at “/root/cleacrcache.sh” and enter folllowing contents

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

  • Set the permission of ” /root/cleacrcache.sh” to 755

 chmod 755  /root/cleacrcache.sh

  • Now edit crontab file

crontab -e

  • Enter following line to set cronjob for clearing cache every hour

0 * * * * /root/clearcache.sh

  • Restart crond service

/etc/init.d/crond restart

 

 If any feedback, queries are always welcome!

The author is a Linux System Administrator and likes to blog.

Facebook Twitter LinkedIn Google+ 


Find helpful? Spread it!
Categories: Linux

Comments are closed.