Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Log memory usage and average load each 5 seconds
free -s 5 | stdbuf -o0 awk '/^Mem/ {mem = $3}; /buffers\/cache/ {buffers = $3}; /^Swap/ {swap = $3; print mem ";" buffers ";" swap}' > free.log &
fish -c 'while true; cat /proc/loadavg; sleep 5s; end' | stdbuf -o0 awk '{print $1}' > loadavg.log &
program
kill %1 %2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment