linux内核报错自动重启
After a kernel panic, it is impossible to remotely connect to the Linux server to reboot it by SSH. How to make the panic kernel automatically reboot itself?
内核崩溃后,无法通过SSH远程连接到Linux服务器以重新启动它。 如何使应急内核自动重启?
Linux kernel has a nice feature that reboots itself after a timeout when a kernel panic happened.
Linux内核具有一项不错的功能,当内核出现恐慌时,它会在超时后重新启动。
Usually, it is disabled by default. To turn it on, you can set the kernel.panic kernel parameter.
通常,默认情况下它是禁用的。 要打开它,可以设置kernel.panic内核参数。
For a running system:
对于正在运行的系统:
# echo 20 >/proc/sys/kernel/panic
Here, 20 is the number of seconds before the kernel reboots. 0 means the feature is disabled.
这里,20是内核重新引导之前的秒数。 0表示该功能已禁用。
To make the configuration persistent, you have 2 choices:
要使配置持久化,您有两种选择:
add the kernel parameter
panic=20to your bootloader (grub or grub2).将内核参数
panic=20添加到引导加载程序(grub或grub2 )。add
kernel.panic = 20to /etc/sysctl.conf .将
kernel.panic = 20添加到/etc/sysctl.conf中。
After you enabled the auto reboot after kernel panic, you may need to check the uptime and logs or create a @reboot cron jobs to send emails or use some other mechanisms to know that there was a auto reboot caused by a kernel panic.
启用内核崩溃后自动重启后,您可能需要检查正常运行时间和日志,或创建@reboot cron作业以发送电子邮件,或使用其他某种机制来知道内核崩溃导致了自动重启。
翻译自: https://www.systutorials.com/how-to-make-linux-automatically-reboot-after-a-kernel-panic/
linux内核报错自动重启
4578




被折叠的 条评论
为什么被折叠?



