Seedbox-Components/Miscellaneous/.boot-script.sh

43 lines
972 B
Bash
Raw Permalink Normal View History

2023-04-19 21:44:15 +08:00
#!/bin/bash
2021-04-26 18:58:42 +08:00
## Network
#NIC Config
interface=$(/sbin/ip -o -4 route show to default | awk '{print $5}')
/sbin/ethtool -G $interface rx 1024
sleep 1
/sbin/ethtool -G $interface tx 2048
sleep 1
/sbin/ethtool -K $interface tso off gso off
sleep 1
#Other 1
/sbin/ifconfig $interface txqueuelen 10000
sleep 1
#Other 2
iproute=$(/sbin/ip -o -4 route show to default)
/sbin/ip route change $iproute initcwnd 25 initrwnd 25
## Drive
#Scheduler
i=1
drive=()
disk=$(lsblk -nd --output NAME)
diskno=$(echo $disk | awk '{print NF}')
while [ $i -le $diskno ]
do
device=$(echo $disk | awk -v i=$i '{print $i}')
drive+=($device)
i=$(( $i + 1 ))
done
2023-02-28 14:44:15 +08:00
i=1 x=0
while [ $i -le $diskno ]
do
diskname=$(eval echo ${drive["$x"]})
disktype=$(cat /sys/block/$diskname/queue/rotational)
if [ "${disktype}" == 0 ]; then
2021-04-26 18:58:42 +08:00
echo kyber > /sys/block/$diskname/queue/scheduler
2023-02-28 14:44:15 +08:00
else
2021-04-26 18:58:42 +08:00
echo mq-deadline > /sys/block/$diskname/queue/scheduler
2023-02-28 14:44:15 +08:00
fi
i=$(( $i + 1 )) x=$(( $x + 1 ))
done
2021-04-26 18:58:42 +08:00
clear
2023-02-28 14:44:15 +08:00
exit 0