Advertisement
oliverthered

zipio.sh

Sep 4th, 2020
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.65 KB | None | 0 0
  1. while true
  2. do
  3. 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}'`
  4. do
  5.         ionice -c 3 -p $i
  6.        echo "process $i reniced to idel as it was hogging io"  
  7. done
  8. for j in `top  -b -d 0.1 -n 5 | awk -F ' ' '{if ( $1 ~ /[0-9]/ && $4 == 0 && $9 > 35.0) print  $1}'`
  9. do
  10.         renice -n 10 -p $j
  11.        echo "process $i reniced to 10 as it was hogging cpu"    
  12. done
  13. for k in `top  -b -d 0.1 -n 1 | awk -F ' ' '{if ( $1 ~ /[0-9]/ && $4 == 10 && $9 < 5.0) print  $1}'`
  14. do
  15.        renice -n 0 -p $k
  16.        echo "process $i reniced to 0 as it stopped hogging cpu"
  17. done
  18. sleep 1
  19. done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement