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!
Categories: Linux







