summaryrefstree
path: root/usr/bin/freecaches.sh
blob: 34b85145c14101477a4cce5fea2114092901dc16 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/bin/sh
#set -x
x=1
while [ $x -eq 1 ]
do
        var=$(free -m | grep Mem: | awk '{print $4;}')
        if [ $var -lt 500 ] ; 
        then
             sync
             echo "drop caches..."
             echo 1 > /proc/sys/vm/drop_caches
             sync
        fi
        sleep 5
done
exit 0