Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- loadthreashold=0.05
- ioprocthreshold=20
- cpuprocthreashold=20.0
- cpuprocreset=5.0
- reniceto=10
- while true
- do
- i=$(cut -d ' ' -f 1 /proc/loadavg)
- if [[ $i > $loadthreashold ]]
- then
- echo "Load exceeds threshold of $loadthreashold"
- for i in $(./iotop -P -b -q -o -d 0.1 -n 5 | awk -F ' ' "{if ( \$1 ~/[0-9]/ && \$10 > $ioprocthreshold && \$2 == "be/0") print \$1}")
- do
- ionice -c 3 -p $i
- echo "process $i reniced to idle as it was hogging io"
- done
- for i in $(top -b -d 0.1 -n 5 | awk -F ' ' "{if ( \$1 ~ /[0-9]/ && \$4 == 0 && \$9 > $cpuprocthreashold) print \$1}")
- do
- renice -n $reniceto -p $i
- echo "process $i reniced to $reniceto as it was hogging cpu"
- </linux-improvements-bundle/zipio-0.3.sh" 30L, 884C 1,1 Top
Advertisement
Add Comment
Please, Sign In to add comment