Trang chủ > VPS - KVM > Hệ điều hành Centos > [How To] Clear cache memory & set cronjob on Linux

[How To] Clear cache memory & set cronjob on Linux

The cache memory in Linux systems is used to speed up the response. To learn more about cache, clickhere to visit the website.

Hopefully, after referring to the website the concept about cache in Linux should get clear.

If you still wish to free up the cache memory here you go.

To clear cache memory using 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 a root user.
  • Create a shell script say "" under root partition and enter following contents
sync; echo 3 > /proc/sys/vm/drop_caches
  • Now, set the permission of script " /root/" to 755
chmod 755 /root/
  • Now edit crontab file
crontab -e
  • Enter following line to set cronjob for clearing cache every hour
0 * * * * /root/
  • Restart crond service
/etc/init.d/crond restart