I run a process that takes lot of time. Time is not a problem actually but I would like to know how much RAM memory it requires. Process is already running so
/usr/bin/time is not an option. I found the pid of my process and run
watch -n 1 grep VmHWM /proc/3100/status
it works nice, I can leave it, do some other work, and just check later what was the value recorded with 1 seconds intervals. The problem starts if/when a process terminates (either finish job, or get killed because of OOM) because watch replace the last valid output with
grep: /proc/3100/status: No such file or directory
-e does not help. Is there a way to make
watch not refresh output on non-zero exit? or show two most recent ones, so the previous zero exit can still be seen?