Skip to main content

Posts

Showing posts with the label regex crashkernel auto linux

Regex foo - checking crashkernel value

I need to check the crashkernel setting on all of my hosts. The issue(s): crashkernel=<blah> can exist anywhere in the string  there may be several iterations of a boot entry which contains crashkernel In this example, I purposely used a grub.conf which had 2 different crashkernel values to demonstrate how to change the enumeration of the test (either 1 or 2). [root@rhvsrv01 ~]# egrep '^[[:space:]]*kernel /vmlinuz.*crashkernel=' /boot/grub/grub.conf | sed -r '1!d;s/.*crashkernel=([[:graph:]]+).*/\1/' auto   [root@rhvsrv01 ~]# egrep '^[[:space:]]*kernel /vmlinuz.*crashkernel=' /boot/grub/grub.conf | sed -r '2!d;s/.*crashkernel=([[:graph:]]+).*/\1/' 16M@128M [root@rhvsrv01 ~]# grep vmlinuz /boot/grub/grub.conf | grep -v \#     kernel /vmlinuz-2.6.32-358.2.1.el6.x86_64 ro root=/dev/mapper/VolGroup00-LogVol01 rd_NO_LUKS LANG=en_US.UTF-8 rd_NO_MD SYSFONT=latarcyrheb-sun16 crashkernel=auto rd_LVM_LV=VolGroup00/LogVol01 rd_LVM_LV=VolGroup00...