Skip to content

Instantly share code, notes, and snippets.

@shaneog
Created May 8, 2014 14:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shaneog/dbea7955d34df4df7aec to your computer and use it in GitHub Desktop.
Save shaneog/dbea7955d34df4df7aec to your computer and use it in GitHub Desktop.
Used on Amazon Linux to set up reasonable system limits
echo "
fs.file-max = 70000" >> /etc/sysctl.conf;
DATA="* soft nofile 64000\n* hard nofile 64000\n* soft nproc 32000\n* hard nproc 32000\n\n# End of file";
DATA=`echo ${DATA} | tr '\n' "\\n"`;
sed -i "s/# End of file/${DATA}/" /etc/security/limits.conf;
echo "# Default limit for number of user's processes to prevent
# accidental fork bombs.
# See rhbz #432903 for reasoning.
* soft nproc 32000
* hard nproc 32000
root soft nproc unlimited" | tee /etc/security/limits.d/90-nproc.conf;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment