Skip to content

Instantly share code, notes, and snippets.

@mateuslopes
Created December 3, 2015 17:30
Show Gist options
  • Save mateuslopes/f2f935381691f69e3cd9 to your computer and use it in GitHub Desktop.
Save mateuslopes/f2f935381691f69e3cd9 to your computer and use it in GitHub Desktop.
ShellScript: Clear linux cache memory
#!/bin/sh
# http://www.unixmen.com/how-to-clear-memory-cache-on-linux-servers/
NOW=$(date +"%F %T")
sh -c "free -mt >> /root/drop_caches.log"
echo "$NOW" >> /root/drop_caches.log
echo "--------------------" >> /root/drop_caches.log
sh -c "sync; echo 3 > /proc/sys/vm/drop_caches"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment