Created
September 27, 2012 21:54
-
-
Save kikaigyo/3796683 to your computer and use it in GitHub Desktop.
リミッターつきpurge.
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 "Testing status of inactive free memory..." | |
if [ "$MM" -gt "$msize" ]; then | |
echo "You have too much inactive free memory. ${MM}MB Releasing now..." | |
purge | |
else | |
echo "Memory amount ${MM}MB does not meet purge threshold." | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment