summaryrefslogtreecommitdiff
path: root/meta-openbmc-mods/meta-common/recipes-core/kernel-panic-check/kernel-panic-check/kernel-panic-check.sh
blob: 815f50b711093cc30a40334596b19d921b0c21bd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/bin/sh
panicFile="/sys/fs/pstore/dmesg-ramoops-0"
if [ -f $panicFile ]
then
    # log the detailed last kernel panic messages
    logger -t kernel-panic-check "Reboot from kernel panic! Log as following:"
    cat $panicFile | logger
    # Also log it to redfish
    cat <<EOF | logger-systemd --journald
REDFISH_MESSAGE_ID=OpenBMC.0.1.BMCKernelPanic
PRIORITY=4
MESSAGE=BMC rebooted due to kernel panic
EOF

    rm -rf $panicFile
fi