Create the memcheck.sh script that will write a mem.log file with the data, and agnuplot script that will plot it.
[gist id=1201994]
Then set up a cron job. First, set the editor to something functional:
export EDITOR=vi
then, crontab -e to edit the cron table. Add this line to run the command every 2 minutes (see wikipedia entry for quick intro), and plot it every 15 minutes:
*/2 * * * * /home/cboettig/./memcheck.sh
*/15 * * * * gnuplot /home/cboettig/memplot.gnu
See resulting plot.