Skip to content

Instantly share code, notes, and snippets.

@opennikish
Last active August 6, 2022 17:32
Show Gist options
  • Save opennikish/08383f95f8f1d433a24fe5b58e06ce5a to your computer and use it in GitHub Desktop.
Save opennikish/08383f95f8f1d433a24fe5b58e06ce5a to your computer and use it in GitHub Desktop.
Simple process statistic reporter script
PID=$1
INTERVAL=$2
# Usage: ./top-pid.sh 12345 5 | tee report.log
while true; do
top -n 1 -b -pid $PID | tail -2 # Use `-l 1` for `-b` (batchmode) on macos
echo -n "\n"
sleep $INTERVAL
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment