scriptmaster
11/2/2017 - 10:24 PM

free.sh

#!/bin/sh
echo "\n\n\n\n\n\n\n\n\nFree RAM before clearing page caches"
free -m


echo "\n\nIt is safe to clear page caches in production, but not dentries or inodes. For example: 1 is safe, 2 and 3 are not safe."
sync
echo "\nFlushed FS buffers, clearing page caches"
echo 1 > /proc/sys/vm/drop_caches

echo "\n\n\n\n\n\n\n\n\n\n\nDone clearing cache.  Let's check the free mem now.\n\n\n"
free -m

echo "\n\n\n\nHoly Cow ! :) -ScriptMaster Sheriff"