linux强行重启

Posted on Posted in linux
Tips: 本文创建于2013年11月18日,已超过 2 年,内容或图片可能已经失效!

有时候因为一些原因,linux输入reboot不好使。使用强制重启命令。

  1. echo?1?>?/proc/sys/kernel/sysrq??
  2. echo?b?>?/proc/sysrq-trigger??

向/proc/sys/kernel/sysrq写入1是开启SysRq功能,写入0是关闭该功能。等同于键盘上的SysRq快捷键。

/proc/sysrq-trigger的参数

# 立即重新启动计算机 (Reboots the kernel without first unmounting file systems or syncing disks attached to the system)

echo "b" > /proc/sysrq-trigger

# 立即关闭计算机(shuts off the system)

echo "o" > /proc/sysrq-trigger

# 导出内存分配的信息 (可以用/var/log/message 查看)(Outputs memory statistics to the console)

echo "m" > /proc/sysrq-trigger

# 导出当前CPU寄存器信息和标志位的信息(Outputs all flags and registers to the console)

echo "p" > /proc/sysrq-trigger

# 导出线程状态信息 (Outputs a list of processes to the console)

echo "t" > /proc/sysrq-trigger

# 故意让系统崩溃 ( Crashes the system without first unmounting file systems or syncing disks attached to the system)

echo "c" > /proc/sysrq-trigger

# 立即重新挂载所有的文件系统 (Attempts to sync disks attached to the system)

echo "s" > /proc/sysrq-trigger

# 立即重新挂载所有的文件系统为只读 (Attempts to unmount and remount all file systems as read-only)

echo "u" > /proc/sysrq-trigger

此外还有两个,类似于强制注销的功能

e — Kills all processes except init using SIGTERM

i — Kills all processes except init using SIGKILL

» 转载请注明来源:若我若鱼 » linux强行重启

Leave a Reply

Your email address will not be published. Required fields are marked *

13 − seven =