-
-
Save congdonglinux/427d22dc752a204a8704d96dee4acf29 to your computer and use it in GitHub Desktop.
Flush Linux pagecache, dentrie & inode (cache) + reswaping 0B
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/sh | |
| # Flush Linux pagecache, dentrie & inode (cache) | |
| # Reswaping 0B | |
| MIN_MEMORY=78643200 # Reswap only if there is free RAM (75MB) | |
| #PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin | |
| #PATH=/bin:/sbin:$PATH | |
| # Flush pagecache + reswaping 0B: | |
| (sync && echo 1 > /proc/sys/vm/drop_caches; if [ "`grep MemFree /proc/meminfo | grep -Eo '[0-9]+'`" -gt "$MIN_MEMORY" ]; then (swapoff -a && swapon -a); fi) | |
| # Flush dentrie и inode (cache) + reswaping 0B: | |
| # (sync && echo 2 > /proc/sys/vm/drop_caches; if [ "`grep MemFree /proc/meminfo | grep -Eo '[0-9]+'`" -gt "$MIN_MEMORY" ]; then (swapoff -a && swapon -a); fi) | |
| # Flush pagecache, dentrie & inode (cache) + reswaping 0B: | |
| # (sync && echo 3 > /proc/sys/vm/drop_caches; if [ "`grep MemFree /proc/meminfo | grep -Eo '[0-9]+'`" -gt "$MIN_MEMORY" ]; then (swapoff -a && swapon -a); fi) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment