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"