Created
September 15, 2011 16:34
-
-
Save kjoconnor/1219733 to your computer and use it in GitHub Desktop.
Stupidly simple memory monitoring script
This file contains 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 | |
# Tested on Ubuntu 8.04 32 bit | |
# When the memory limit drops below $memory_limit megabytes, bash will ring a bell | |
# and echo the current memory usage. | |
# Set the free memory limit (in megabytes) | |
memory_limit=150 | |
# Check interval (in seconds) | |
interval=30 | |
while true; do | |
free_memory=`free -m | tail -2 | head -1 | awk '{print $4;}'` | |
if (( $free_memory < $memory_limit )); then | |
echo "Warning: memory is $free_memory!" | |
echo $'\a' | |
fi | |
sleep $interval | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment