Automatic reboot after Linux kernel panic
http://www.syn-ack.org/centos-linux/automatic-reboot-after-linux-kernel-panic/
Kernel panics for all sorts of reasons. Both hardware failures and software failures. It is always important to investigate the reason for the kernel panic so you can resolve it. However, sometimes system update is critical and you want the system to reboot automatically after a kernel panic. Luckily this is very easy to achieve.
Before you configure automatic reboots after kernel panics
Before you go ahead and configure automatic reboots take note of the following: make sure you are aware when kernel panics occur, and when they do make sure you investigate the reason why it happens.
Make sure you are aware of kernel panics
When the system doesn’t automatically reboot it’s quite easy to discover a kernel panic: the system simply doesn’t respond anymore. However when the system automatically reboots it gets quite a bit harder. Make sure you set-up appropriate logging for this.
Always investigate the issue
Getting the system back online is not a reason for not investigating the issue. Although the downtime is limited, it still takes a couple of minutes to reboot the system. Kernel panics may happen anytime, and they tend to happen especially during high traffic peaks. Don’t ignore the kernel panic but research and resolve the problem.
Configure automatic reboots in /etc/sysctl.conf
To set-up automatic reboots after kernel panic, simply add the following lines to your /etc/sysctl.conf file:
# Kernel panic reboot
kernel.panic = 10
This setting tells the system to reboot in 10 seconds after a kernel panic.
Refresh the /etc/sysctl.conf file
After you’ve made the change make sure you tell the system to re-read its sysctl config by issueing:
sysctl -p
That’s all! From now your system will automatically reboot after a kernel panic.