Hello,
Working on a few test programs here... html5 apps that are a bit buggy.. .anyone know how to:
Make a bash script to detect when cpu usage is 80% or more- then run a killall chrome command.?
thanks for help,
Johan
a bash script to check cpu usage?
while i_know_what_i_am_doing; do
sleep 1
done
Code: Select all
IDLE=`top -n1| grep -o -e '[0-9]*\% idle' |sed 's%[^[:digit:]]%%g'`
echo $IDLE
#45
done
- divisionmd
- Posts: 606
- Joined: Sat 14 Jul 2007, 20:42
code should work, but that above was on Racy-5.5,
which has Busybox-1.19.x or above
and my current 1.18.3 seems to need the -b option passed to top additionally
and does not show correct values: 95% of the time it is 100% idle or 0% though top without options in another console shows 80% idle.
check busybox version by issuing busybox in the console.
which has Busybox-1.19.x or above
and my current 1.18.3 seems to need the -b option passed to top additionally
and does not show correct values: 95% of the time it is 100% idle or 0% though top without options in another console shows 80% idle.
check busybox version by issuing busybox in the console.
- divisionmd
- Posts: 606
- Joined: Sat 14 Jul 2007, 20:42