This commit is contained in:
jerry048 2023-02-27 02:04:54 +08:00
parent 8585bb29b8
commit 3cbd0f9a0f
12 changed files with 66 additions and 43 deletions

View File

@ -1,9 +1,4 @@
#!/bin/sh
function boot_script {
touch /etc/rc.local && chmod +x /etc/rc.local
cat <<'EOF' > /etc/rc.local
#!/bin/sh
## Network
#NIC Config
interface=$(/sbin/ip -o -4 route show to default | awk '{print $5}')
@ -52,6 +47,4 @@ else
done
fi
clear
exit 0
EOF
}
exit 0

View File

@ -1,9 +1,13 @@
function qBittorrent_download {
## Allow users to determine which version of qBittorrent to be installed
need_input; echo "Please enter your choice (qBittorrent Version - libtorrent Version):"; normal_3
options=("qBittorrent 4.1.9.1 - libtorrent-1_1_14" "qBittorrent 4.3.9 - libtorrent-v1.2.18" "qBittorrent 4.4.5 - libtorrent-v1.2.18" "qBittorrent 4.4.5 - libtorrent-v2.0.8" "qBittorrent 4.5.0 - libtorrent-v1.2.18" "qBittorrent 4.5.0 - libtorrent-v2.0.8")
options=("qBittorrent 4.1.9 - libtorrent-1_1_14" "qBittorrent 4.1.9.1 - libtorrent-1_1_14" "qBittorrent 4.3.9 - libtorrent-v1.2.18" "qBittorrent 4.4.5 - libtorrent-v1.2.18" "qBittorrent 4.4.5 - libtorrent-v2.0.8" "qBittorrent 4.5.1 - libtorrent-v1.2.18" "qBittorrent 4.5.1 - libtorrent-v2.0.8")
select opt in "${options[@]}"
do
case $opt in
"qBittorrent 4.1.9. - libtorrent-1_1_14")
qBver=4.1.9 && libver=libtorrent-1_1_14; break
;;
"qBittorrent 4.1.9.1 - libtorrent-1_1_14")
qBver=4.1.9.1 && libver=libtorrent-1_1_14; break
;;
@ -16,11 +20,11 @@ function qBittorrent_download {
"qBittorrent 4.4.5 - libtorrent-v2.0.8")
qBver=4.4.5 && libver=libtorrent-v2.0.8; break
;;
"qBittorrent 4.5.0 - libtorrent-v1.2.18")
qBver=4.5.0 && libver=libtorrent-v1.2.18; break
"qBittorrent 4.5.1 - libtorrent-v1.2.18")
qBver=4.5.1 && libver=libtorrent-v1.2.18; break
;;
"qBittorrent 4.5.0 - libtorrent-v2.0.8")
qBver=4.5.0 && libver=libtorrent-v2.0.8; break
"qBittorrent 4.5.1 - libtorrent-v2.0.8")
qBver=4.5.1 && libver=libtorrent-v2.0.8; break
;;
*) warn_1; echo "Please choose a valid version"; normal_3;;
esac
@ -62,10 +66,31 @@ EOF
}
function qBittorrent_config {
## Determine if it is a SSD or a HDD and tune certain parameters
disktype=$(cat /sys/block/sda/queue/rotational)
if [ "${disktype}" == 0 ]; then
aio=12
low_buffer=5120
buffer=20480
buffer_factor=250
else
aio=4
low_buffer=3072
buffer=10240
buffer_factor=150
fi
##
systemctl stop qbittorrent-nox@$username
##
if [[ "${qBver}" =~ "4.1." ]]; then
md5password=$(echo -n $password | md5sum | awk '{print $1}')
cat << EOF >/home/$username/.config/qBittorrent/qBittorrent.conf
[BitTorrent]
Session\AsyncIOThreadsCount=$aio
Session\SendBufferLowWatermark=$low_buffer
Session\SendBufferWatermark=$buffer
Session\SendBufferWatermarkFactor=$buffer_factor
[LegalNotice]
Accepted=true
@ -85,6 +110,12 @@ EOF
wget https://raw.githubusercontent.com/jerry048/Seedbox-Components/main/Torrent%20Clients/qBittorrent/qb_password_gen && chmod +x $HOME/qb_password_gen
PBKDF2password=$($HOME/qb_password_gen $password)
cat << EOF >/home/$username/.config/qBittorrent/qBittorrent.conf
[BitTorrent]
Session\AsyncIOThreadsCount=$aio
Session\SendBufferLowWatermark=$low_buffer
Session\SendBufferWatermark=$buffer
Session\SendBufferWatermarkFactor=$buffer_factor
[LegalNotice]
Accepted=true
@ -108,10 +139,14 @@ EOF
MemoryWorkingSetLimit=$Cache_qB
[BitTorrent]
Session\AsyncIOThreadsCount=$aio
Session\DefaultSavePath=/home/$username/qbittorrent/Downloads/
Session\DiskCacheSize=$Cache_qB
Session\Port=45000
Session\QueueingSystemEnabled=false
Session\SendBufferLowWatermark=$low_buffer
Session\SendBufferWatermark=$buffer
Session\SendBufferWatermarkFactor=$buffer_factor
[LegalNotice]
Accepted=true

View File

@ -5,7 +5,7 @@ function Update {
normal_1; echo "Updating installed packages and install prerequisite"
normal_2
apt-get -qqy update && apt-get -qqy upgrade
apt-get -qqy install sudo sysstat htop curl psmisc python3-pyqt5
apt-get -qqy install sudo sysstat htop curl psmisc
cd $HOME
tput sgr0; clear
}

View File

@ -107,39 +107,34 @@ function kernel_Tweaking {
# Grabing the informations of the server to be used in determining certain Tweaking parameters
memsize=$(grep MemTotal /proc/meminfo | awk '{print $2}')
if (($memsize > 16000000)); then
rmem_default=16777216
rmem_max=67108864
wmem_default=16777216
wmem_max=67108864
tcp_mem='262144 1572864 2097152'
tcp_rmem='4194304 16777216 67108864'
tcp_wmem='4194304 16777216 67108864'
elif (($memsize > 8000000)); then
tcp_mem='262144 524288 1048576'
elif (($memsize > 4000000)); then
tcp_mem='32768 65536 65536'
else
tcp_mem='32768 32768 32768'
fi
interface=$(/sbin/ip -o -4 route show to default | awk '{print $5}')
nic_speed=$(ethtool $interface | grep Speed | awk '{print $2}' | tr -d -c 0-9)
if (($nic_speed = 10000)); then
rmem_default=33554432
rmem_max=67108864
wmem_default=67108864
wmem_max=134217728
tcp_rmem='4194304 33554432 67108864'
tcp_wmem='4194304 67108864 134217728'
else
rmem_default=16777216
rmem_max=33554432
wmem_default=16777216
wmem_max=33554432
tcp_mem='262144 524288 1048576'
tcp_rmem='4194304 16777216 33554432'
tcp_wme='4194304 16777216 33554432'
elif (($memsize > 4000000)); then
rmem_default=8388608
rmem_max=16777216
wmem_default=8388608
wmem_max=16777216
tcp_mem='32768 65536 65536'
tcp_rmem='4194304 8388608 16777216'
tcp_wmem='4194304 8388608 16777216'
else
rmem_default=8388608
rmem_max=8388608
wmem_default=8388608
wmem_max=8388608
tcp_mem='32768 32768 32768'
tcp_rmem='4194304 8388608 8388608'
tcp_wmem='4194304 8388608 8388608'
fi
tcp_wmem='4194304 16777216 33554432'
fi
cat << EOF >/etc/sysctl.conf
###/proc/sys/kernel/ Variables:
@ -386,8 +381,8 @@ net.ipv4.tcp_mem = $tcp_mem
# case this value is ignored.
net.ipv4.tcp_rmem = $tcp_rmem
# Disable receive buffer auto-tuning
net.ipv4.tcp_moderate_rcvbuf = 0
# Enable receive buffer auto-tuning
net.ipv4.tcp_moderate_rcvbuf = 1
# Distribution of socket receive buffer space between TCP window size(this is the size of the receive window advertised to the other end), and application buffer/
#The overhead (application buffer) is counted as bytes/2^tcp_adv_win_scale i.e. Setting this 2 would mean we use 1/4 of socket buffer space as overhead
@ -482,8 +477,8 @@ net.ipv4.tcp_window_scaling = 1
net.ipv4.tcp_workaround_signed_windows = 1
# The maximum amount of unsent bytes in TCP socket write queue
net.ipv4.tcp_notsent_lowat = 983040
# The maximum amount of unsent bytes in TCP socket write queue, this is on top of the congestion window
net.ipv4.tcp_notsent_lowat = 131072
# Controls the amount of data in the Qdisc queue or device queue
net.ipv4.tcp_limit_output_bytes = 3276800