#/bin/bash

test $(grep -ci "net.core.rmem_max" /etc/sysctl.conf) -eq 0 && echo "net.core.rmem_max=20971520" | sudo tee -a /etc/sysctl.conf
test $(grep -ci "net.core.wmem_max" /etc/sysctl.conf) -eq 0 && echo "net.core.wmem_max=2097152" | sudo tee -a /etc/sysctl.conf
test $(grep -ci "net.core.netdev_max_backlog" /etc/sysctl.conf) -eq 0 && echo "net.core.netdev_max_backlog=10000" | sudo tee -a /etc/sysctl.conf

test $(grep -ci "net.ipv4.udp_rmem_min" /etc/sysctl.conf) -eq 0 && echo "net.ipv4.udp_rmem_min=2097152" | sudo tee -a /etc/sysctl.conf
test $(grep -ci "fs.inotify.max_user_watches" /etc/sysctl.conf) -eq 0 && echo "fs.inotify.max_user_watches=2097152" | sudo tee -a /etc/sysctl.conf
test $(grep -ci "* soft core" /etc/security/limits.conf) -eq 0 && echo "* soft core unlimited" | sudo tee -a  /etc/security/limits.conf
test $(grep -ci "* hard core" /etc/security/limits.conf) -eq 0 && echo "* hard core unlimited" | sudo tee -a  /etc/security/limits.conf

sudo sysctl -p

