Update tweaking.sh

This commit is contained in:
jerry048 2023-02-28 14:53:06 +08:00
parent 0a2483d53f
commit bbee0103dd
1 changed files with 15 additions and 20 deletions

View File

@ -45,7 +45,7 @@ function Network_Other_Tweaking {
apt-get -qqy install net-tools
ifconfig $interface txqueuelen 10000
sleep 1
#Other 2
#Increaseing the congestion windows
iproute=$(ip -o -4 route show to default)
ip route change $iproute initcwnd 25 initrwnd 25
}
@ -57,35 +57,30 @@ function Scheduler_Tweaking {
normal_1; echo "Changing I/O Scheduler"; warn_2
i=1
drive=()
#List out all the available drives
disk=$(lsblk -nd --output NAME)
#Count the number of drives
diskno=$(echo $disk | awk '{print NF}')
#Putting the device name in an array to loop through later
while [ $i -le $diskno ]
do
device=$(echo $disk | awk -v i=$i '{print $i}')
drive+=($device)
i=$(( $i + 1 ))
done
i=1
x=0
disk_name=$(printf $(lsblk | grep -m1 'disk' | awk '{print $1}'))
disktype=$(cat /sys/block/$disk_name/queue/rotational)
if [ "${disktype}" == 0 ]; then
while [ $i -le $diskno ]
do
diskname=$(eval echo ${drive["$x"]})
i=1 x=0
#Changing the scheduler per disk depending on whether they are HDD or SSD
while [ $i -le $diskno ]
do
diskname=$(eval echo ${drive["$x"]})
disktype=$(cat /sys/block/$diskname/queue/rotational)
if [ "${disktype}" == 0 ]; then
echo kyber > /sys/block/$diskname/queue/scheduler
i=$(( $i + 1 ))
x=$(( $x + 1 ))
done
else
while [ $i -le $diskno ]
do
diskname=$(eval echo ${drive["$x"]})
else
echo mq-deadline > /sys/block/$diskname/queue/scheduler
i=$(( $i + 1 ))
x=$(( $x + 1 ))
done
fi
fi
i=$(( $i + 1 )) x=$(( $x + 1 ))
done
}