From 7e3465269dae0b2f470c0ce474ec5f2b8bd69321 Mon Sep 17 00:00:00 2001 From: Xiufeng Guo Date: Thu, 31 Oct 2024 02:28:17 +0900 Subject: [PATCH] Update debian.sh --- debian.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/debian.sh b/debian.sh index 69bcfcf..5cb67d8 100644 --- a/debian.sh +++ b/debian.sh @@ -287,8 +287,13 @@ function custom_sysctl() { printf "\E[0;35;40m" echo '### Custom sysctl.conf ###' printf "\E[0m" - cp -r /etc/sysctl.conf /etc/sysctl.conf.$(date +"%Y_%m_%d_%I_%M_%p").bak - cat /dev/null > /etc/sysctl.conf + + # Backup sysctl.conf + if [ -f /etc/sysctl.conf ]; then + cp -r /etc/sysctl.conf /etc/sysctl.conf.$(date +"%Y_%m_%d_%I_%M_%p").bak + cat /dev/null > /etc/sysctl.conf + fi + cat > /etc/sysctl.d/local.conf << EOF net.ipv4.ip_forward = 1 net.ipv4.conf.all.proxy_arp = 0 @@ -330,7 +335,9 @@ net.ipv4.ipfrag_high_thresh = 4194304 net.ipv4.ipfrag_low_thresh = 3145728 net.ipv4.ping_group_range = 0 2147483647 EOF + sysctl -p + printf "\E[0;33;40m" echo "### Custom sysctl.conf added ###" printf "\E[0m"