Forcing Linux (Server / Node) to Instantly Crash a

2019-10-10 08:20发布

问题:

Failure scenarios are complex and the potential responses of a multi layer complex application (or even a set of applications) requires hard thinking and complex understanding as well as complex implementations.

To ease the pain todays servers have power supplies being able to be programmatically switched off and on again to force an instant dead of the server and an instant reboot. This is referred to shooting a server in the head or putting a bullet in/through the head of the server.

Since todays server are usually virtual and sometimes the server is not equipt with power control or programmatically accessable kill switches, crashing the OS is the best option.

So how can one do this?

I need a solution in a very narrow timeframe (like 1000ns) and does not send kill signals or give any part of the OS time to even act and most importantly not to recover.

回答1:

According to this blog you can do following:

echo 1 > /proc/sys/kernel/sysrq 
echo b > /proc/sysrq-trigger

To enable it you probably need to put following in sysctl.conf:

kernel.sysrq = 1

This should more or less act in the same way as pressing reset button on the machine.



回答2:

I don't get it, if you're looking for a reboot in general then the command to go for is:

sudo reboot



标签: linux