#!/bin/sh
while true
do
# date +%Y-%m-%d/%H:%M:%S >>mem.txt
# ps aux | grep yourgrogram | awk 'NR==1{ print $5/1024/1024,$6/1024/1024}' | cat >> mem.txt
echo `date "+%Y-%m-%d~%H:%M:%S"` `ps aux | grep yourgrogram | awk 'NR==1{ print "\t"$5/1024/1024"g""\t"$6/1024/1024"g"}'` >> mem2.txt
#sleep 1h
sleep 3s
done
while true
do
# date +%Y-%m-%d/%H:%M:%S >>mem.txt
# ps aux | grep yourgrogram | awk 'NR==1{ print $5/1024/1024,$6/1024/1024}' | cat >> mem.txt
echo `date "+%Y-%m-%d~%H:%M:%S"` `ps aux | grep yourgrogram | awk 'NR==1{ print "\t"$5/1024/1024"g""\t"$6/1024/1024"g"}'` >> mem2.txt
#sleep 1h
sleep 3s
done