`
wangxc
  • 浏览: 209803 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

Linux服务器在kernel panic时自动重启

阅读更多
配置的方法很简单:
sudo vi /etc/sysctl.conf


编辑sysct1.conf文件,在文件加入

kernel.panic = 20


当系统遇到 kernel panic 20秒后自动重启。

linux在遇到kernel panic时,是怎么工作的,最权威的资料永远来自内核源代码:


 ....  
   if (panic_timeout > 0) {  
                /*  
                 * Delay timeout seconds before rebooting the machine.
                 * We can't use the "normal" timers since we just panicked.
                 */ 
                printk(KERN_EMERG "Rebooting in %d seconds..", panic_timeout);  

                for (i = 0; i < panic_timeout*1000; ) {  
                        touch_nmi_watchdog();  
                       i += panic_blink(i); 
                        mdelay(1);  
                        i++;  
                }  

               /*  
                * This will not be a clean reboot, with everything 
                * shutting down.  But if there is a chance of                    
                * rebooting the system it will be rebooted. 
                */

              emergency_restart();  

        }  

......


分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics