Reboot Linux box after a kernel panic


If you want the server to get rebooted automatically after kernel hit by a panic error message, try adding panic=N to /etc/sysctl.conf file.
It specify kernel behavior on panic. By default, the kernel will not reboot after a panic, but this option will cause a kernel reboot after N seconds. For example following boot parameter will force to reboot Linux after 10 seconds.


[root@localhost ~]# cat /proc/sys/kernel/panic
0

[root@localhost ~]# sysctl -a | grep kernel.panic

kernel.panic = 0

[root@localhost ~]#

[root@localhost ~]# echo "10" > /proc/sys/kernel/panic
0

[root@localhost ~]# grep kernel.panic /etc/sysctl.conf

kernel.panic = 10

[root@localhost ~]# sysctl -p



Or Follow the below procedure

Open /etc/sysctl.conf file

# vi /etc/sysctl.conf

When kernel panic's, reboot after 10 second delay

kernel.panic = 10