Guest User

antioom.sh

a guest
Nov 26th, 2018
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.58 KB | None | 0 0
  1. names="com.termux io.twaik.lorie rubberbigpepper.Orientator"
  2. if test ! -e /realproc/cmdline
  3. then
  4. echo Mounting realproc
  5. mount -o remount,rw none /
  6. mkdir /realproc
  7. mount -t proc none /realproc
  8. fi
  9.  
  10. tail -f /dev/null|am monitor| while read line
  11. do
  12. echo "$line"
  13. for n in $names
  14. do
  15. for p in `pidof $n`
  16. do
  17. if test -e /proc/$p/oom_adj
  18. then
  19. echo Masking pid $p
  20. mount -t tmpfs -o size=4k none /proc/$p/
  21. for f in /realproc/$p/*
  22. do ln -s $f /proc/$p
  23. done
  24. rm /proc/$p/oom_*
  25. fi
  26. echo Setting oom adj, was $(cat /realproc/$p/oom_adj)
  27. echo -17 > /realproc/$p/oom_adj
  28. done
  29. done
  30. done
Add Comment
Please, Sign In to add comment