Force Reboot/Shutdown your linux machine

managing linux server remotely can be hard, especially when you need to phisically restart or shutdown the server.
these are scripts to hard reset or hard shutdown your linux machine, hard means just like you sit in front of your machine and hit the reset / power button.

force reboot your machine, just like “press the reset button”

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

if you want to force shutdown machine, just like “press the power button”

$ echo 1 > /proc/sys/kernel/sysrq
$ echo o > /proc/sysrq-trigger

the script will bypass disc syncing, close application, daemon, etc. during regular reboot/shutdown process.
you will find this script useful when the machine is not responding, and you still have SSH session.

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s