shell script to record memory usage