ansitest/clearcache.sh

24 lines
469 B
Bash
Raw Normal View History

2022-03-14 12:43:36 -05:00
#!/bin/bash
2022-03-14 12:44:16 -05:00
# free up cache RAM - run as root
2022-03-14 12:43:36 -05:00
# http://linux-mm.org/Drop_Caches
# uname -a
#Darwin davesimac-2.local 15.6.0 Darwin
[ `uname -a |grep -ci darwin` -gt 0 ] && exit 1;
2022-03-14 12:44:16 -05:00
time sync
2022-03-14 12:43:36 -05:00
free
echo 1 > /proc/sys/vm/drop_caches # free pagecache
#To free dentries and inodes:
[ "$*" = "2" ] && echo 2 > /proc/sys/vm/drop_caches
#To free pagecache, dentries and inodes:
[ "$*" = "3" ] && echo 3 > /proc/sys/vm/drop_caches
#echo 3 > /proc/sys/vm/drop_caches
free