Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # change value for your limit open files:
- openfiles="65535"
- # backup .conf files:
- cp -f /etc/security/limits.conf{,.bak}
- cp -f /etc/systemd/system.conf{,.bak}
- cp -f /etc/systemd/user.conf{,.bak}
- cp -f /etc/sysctl.conf{,.bak}
- # adding parameters
- sh -c 'echo "* soft nproc '$openfiles'" >> /etc/security/limits.conf'
- sh -c 'echo "* hard nproc '$openfiles'" >> /etc/security/limits.conf'
- sh -c 'echo "* soft nofile '$openfiles'" >> /etc/security/limits.conf'
- sh -c 'echo "* hard nofile '$openfiles'" >> /etc/security/limits.conf'
- sh -c 'echo "root soft nproc '$openfiles'" >> /etc/security/limits.conf'
- sh -c 'echo "root hard nproc '$openfiles'" >> /etc/security/limits.conf'
- sh -c 'echo "root soft nofile '$openfiles'" >> /etc/security/limits.conf'
- sh -c 'echo "root hard nofile '$openfiles'" >> /etc/security/limits.conf'
- sh -c 'echo "DefaultLimitNOFILE='$openfiles'" >> /etc/systemd/system.conf'
- sh -c 'echo "DefaultLimitNOFILE='$openfiles'" >> /etc/systemd/user.conf'
- sh -c 'echo "fs.file-max = '$openfiles'" >> /etc/sysctl.conf'
- sh -c 'echo "net.core.somaxconn = '$openfiles'" >> /etc/sysctl.conf'
Advertisement
Advertisement