Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- if [ $# -ne 2 ]; then
- echo "wrong"
- exit
- fi
- cpulimit=$1
- memlimit=$2
- osd_prop='-c blue -f -*-helvetica-bold-r-*-*-34-*-*-*-*-*-*\
- -p middle -A center -d 2 --shadow=1'
- while(:); do
- cpuguys=`top -b -n1 | awk '$9>'$cpulimit' && NR > 5{ print $12 }'`
- memguys=`top -b -n1 | awk '$10>'$memlimit' && NR > 5{ print $12 }'`
- for d in $cpuguys; do
- print `echo $d 'is taking more than ' $cpulimit '% cpu power'\
- | osd_cat $osd_prop`
- sleep 3
- done
- for d in $memguys; do
- print `echo $d 'is using more than ' $memlimit '% of your memory'\
- | osd_cat $osd_prop`
- sleep 3
- done
- sleep 60
- done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement