Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- while true
- do
- for i in `iotop -P -b -q -o -d 0.1 -n 5 | awk -F ' ' '{if ( $1 ~ /[0-9]/ && $10 > 20 && $2 == "be/0") print $1}'`
- do
- ionice -c 3 -p $i
- echo "process $i reniced to idel as it was hogging io"
- done
- for j in `top -b -d 0.1 -n 5 | awk -F ' ' '{if ( $1 ~ /[0-9]/ && $4 == 0 && $9 > 35.0) print $1}'`
- do
- renice -n 10 -p $j
- echo "process $i reniced to 10 as it was hogging cpu"
- done
- for k in `top -b -d 0.1 -n 1 | awk -F ' ' '{if ( $1 ~ /[0-9]/ && $4 == 10 && $9 < 5.0) print $1}'`
- do
- renice -n 0 -p $k
- echo "process $i reniced to 0 as it stopped hogging cpu"
- done
- sleep 1
- done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement