Journal GameboyRMH's Journal: Live system RAM testing script
Here's a memory-testing script I wrote for my home server. Normally if you have a computer with non-ECC RAM you notice bad RAM when the computer acts insane - random crashes, files getting corrupted for no apparent reason, things like that. This will run a memory test while your OS is up and running, using whatever free RAM is available minus a reserve amount. You need to have memtester installed to use this script. I set mine to run once a week, it will peg your CPU and of course consume a lot of RAM while running.
#!
/bin/bash
logfile='/var/log/memreport'
date +'%c' > $logfile
free -h >> $logfile
#Amount of RAM in MB to leave free when testing:
reserveram=256
#Get free RAM
freeram=`free -m | grep Mem | sed 's/\s\+/,/g' | cut -d , -f4`;
cachedram=`free -m | grep Mem | sed 's/\s\+/,/g' | cut -d , -f7`;
testram=`expr $freeram + $cachedram - $reserveram`;
if [ $testram -gt 0 ]
then
memtester `echo -n $testram`M 1 >> $logfile
else
echo "Insufficient free RAM for test" >> $logfile
fi
#----Check for errors and put warning in Issues file---
ERRORS=`grep -i fail $logfile`
if [ -n "$ERRORS" ]
then
echo "\n WARNING - Memory Errors! \n" >>/etc/issue.custom
fi
Thanks to ASLR it will test a practically random sampling of the majority of your available RAM every time it runs, and hopefully catch any errors early on.
Live system RAM testing script More Login
Live system RAM testing script
Slashdot Top Deals