kdump.defaults 475 B

1234567891011121314151617181920212223
  1. #!/bin/sh
  2. # kB disable if mem low than 256MB
  3. memtotal=`grep MemTotal /proc/meminfo | awk '{print $2}'`
  4. if test $memtotal -le 262144; then
  5. exit 0
  6. fi
  7. KZ=128
  8. if test $memtotal -ge 8388608; then
  9. KZ=512
  10. elif test $memtotal -ge 4194304; then
  11. KZ=256
  12. fi
  13. case $(uname -m) in
  14. i?86|x86_64)
  15. if ! grep -q crashkernel /boot/grub/grub.cfg; then
  16. mount /boot -o remount,rw
  17. sed -i "s/linux.*/& crashkernel=${KZ}M/" /boot/grub/grub.cfg
  18. mount /boot -o remount,ro
  19. fi
  20. ;;
  21. esac