1
0

sysctl 492 B

12345678910111213141516171819202122232425
  1. #!/bin/sh /etc/rc.common
  2. # Copyright (C) 2006 OpenWrt.org
  3. START=11
  4. set_vm_min_free() {
  5. mem="$(grep MemTotal /proc/meminfo | awk '{print $2}')"
  6. if [ "$mem" -gt 65536 ]; then # 128M
  7. val=16384
  8. elif [ "$mem" -gt 32768 ]; then # 64M
  9. val=8192
  10. elif [ "$mem" -gt 16384 ]; then # 32M
  11. val=1024
  12. else
  13. return
  14. fi
  15. sysctl -qw vm.min_free_kbytes="$val"
  16. }
  17. start() {
  18. set_vm_min_free
  19. for CONF in /etc/sysctl.conf /etc/sysctl.d/*.conf; do
  20. [ -f "$CONF" ] && sysctl -p "$CONF" -e >&-
  21. done
  22. }