Sometimes the reboot, shutdown or halt command fail. Then this is the answer:
echo 1 >/proc/sys/kernel/sysrq echo b >/proc/sysrq-trigger
View the discussion thread.