rc.local for ubuntu

This commit is contained in:
qtwrk 2021-12-12 21:57:14 +01:00 committed by GitHub
parent f038ea274d
commit e2e7f415a0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 0 deletions

View File

@ -1112,9 +1112,16 @@ if ! grep -q "pid_max" /etc/rc.local 2>/dev/null ; then
echo 1 > /sys/kernel/mm/ksm/run" >>/etc/rc.d/rc.local
chmod +x /etc/rc.d/rc.local
else
if [[ -f /etc/rc.local ]] ; then
echo -e "#!/bin/bash\n$(cat /etc/rc.local)" > /etc/rc.local
else
echo "#!/bin/bash" > /etc/rc.local
fi
echo "echo 1000000 > /proc/sys/kernel/pid_max
echo 1 > /sys/kernel/mm/ksm/run" >>/etc/rc.local
chmod +x /etc/rc.local
systemctl enable rc-local >/dev/null 2>&1
systemctl start rc-local >/dev/null 2>&1
fi
if grep -q "nf_conntrack_max" /etc/sysctl.conf ; then
sysctl -w net.netfilter.nf_conntrack_max=2097152 > /dev/null