Created
September 28, 2012 02:49
-
-
Save kikaigyo/3797673 to your computer and use it in GitHub Desktop.
purge_ja
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
#!/bin/bash | |
# This script checks the available inactive memory. | |
# Memory is purged if the available number of MB is | |
# greater than the following "msize" variable. Attach | |
# this script to launchd to run it periodically. | |
msize=1200 | |
MM=`vm_stat | awk '/Pages\ inactive\:/ {print int($3/256)}'` | |
echo "非使用中のメモリサイズを計算しています..." | |
echo "" | |
if [ "$MM" -gt "$msize" ]; then | |
echo "現在${MM}MBのメモリが非使用領域として確保されています。設定値${msize}MBを超えたためpurgを実行します..." | |
echo"" | |
purge | |
else | |
echo "現在非使用中のメモリは${MM}MBです。設定値${msize}MB以下のためpurgeはキャンセルされました。" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment