Last Updated: February 25, 2016
·
1.227K
· wnkz

Force reboot on Debian

Ever wanted to force a reboot on Debian without taking the risk of losing your SSH session and still having processes hanging on ?

Try this:

#!/bin/sh

# Flush IO buffers to avoid losing any data
echo s > /proc/sysrq-trigger

# Umount and remount all partition in Read Only
echo u > /proc/sysrq-trigger

# Force host reboot
echo b > /proc/sysrq-trigger

It's almost the same as holding down the power button, very efficient.