#!/bin/bash###author xxx###date xxx###清理内存缓存 used=`free -m | awk 'NR==2' | awk '{print $3}'`free=`free -m | awk 'NR==2' | awk '{print $4}'` echo "===========================" >> /var/log/mem.logdate >> /var/log/mem.logecho "Memory usage | [Use:${used}MB][Free:${free}MB]" >> /var/log/mem.log if [ $free -le 2000 ] then sync && echo 1 > /proc/sys/vm/drop_caches sync && echo 2 > /proc/sys/vm/drop_caches sync && echo 3 > /proc/sys/vm/drop_caches echo "OK" >> /var/log/mem.logelse echo "Not required" >> /var/log/mem.logfi