1 2 3 4 5 6 7 8 9 10 11
#!/bin/bash cputime_file=${TMPDIR-/tmp}/cputime mpstat -P ALL 1 > "$cputime_file" & while true; do cputime="`tail -n4 "$cputime_file"`" echo "$cputime">"$cputime_file" sleep 1 done