https://rumenz.com/rumenbiji/linux-buff-cache.html
> sync
> echo 1 > /proc/sys/vm/drop_caches
> echo 2 > /proc/sys/vm/drop_caches
> echo 3 > /proc/sys/vm/drop_caches
定期清理脚本:
> vim clean.sh
#!/bin/bash#每两小时清除一次缓存
echo "开始清除缓存"
sync;sync;sync #写入硬盘,防止数据丢失
sleep 20#延迟20秒
echo 1 > /proc/sys/vm/drop_caches
echo 2 > /proc/sys/vm/drop_caches
echo 3 > /proc/sys/vm/drop_caches
> chmod +x clean.sh
> crontab -e
# 每两小时执行一次
0 */2 * * * /opt/clean.sh