Skip to content

Instantly share code, notes, and snippets.

@gbaptista
Last active February 26, 2018 14:42
Show Gist options
  • Save gbaptista/cc2c3c2cbb2ccd3ae4ef235e41f1a935 to your computer and use it in GitHub Desktop.
Save gbaptista/cc2c3c2cbb2ccd3ae4ef235e41f1a935 to your computer and use it in GitHub Desktop.
Don't let Chromium, Chrome, Opera, Firefox or Atom freeze your system!
# crontab
sudo su
crontab -e
* * * * * bash limits.sh
# shell script
# 6 gb ~ 7 gb
ps aux | grep 'chromium' | awk '{print $2}' | xargs -I % prlimit -p % --as=6000000000:7000000000
ps aux | grep 'chrome' | awk '{print $2}' | xargs -I % prlimit -p % --as=6000000000:7000000000
ps aux | grep 'firefox' | awk '{print $2}' | xargs -I % prlimit -p % --as=6000000000:7000000000
ps aux | grep 'opera' | awk '{print $2}' | xargs -I % prlimit -p % --as=6000000000:7000000000
# 3 gb ~ 4 gb
ps aux | grep 'atom' | awk '{print $2}' | xargs -I % prlimit -p % --as=3000000000:4000000000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment