All pastes #2108993 Raw Edit

Mine

public shellscript v1 · immutable
#2108993 ·published 2012-02-02 10:21 UTC
rendered paste body
#!/usr/bin/env bashfile="/tmp/cpustats"delay="10"set -o noclobber{ >"$file"; } &>/dev/null || { cat "$file"; exit 0; }set +o noclobberLC_ALL=C top -b -n 1 | grep "^Cpu" >"$file"cat "$file"(        [[ -t 0 ]] && exec 0>/dev/null        [[ -t 1 ]] && exec 1>/dev/null        [[ -t 2 ]] && exec 2>/dev/null        trap : HUP        while read -r line; do                echo "$line" >"$file"        done < <(                LC_ALL=C top -b -d "$delay" | grep --line-buffered "^Cpu"        )) &disownexit 0