This can be accomplished on *nix systems by using the system requests feature. Generally this is disabled for security reasons, but you can enable it with root privileges and request power off to the system immediately as follows:
echo 1 > /proc/sys/kernel/sysrq-trigger ;
echo o > /proc/sysrq-trigger
where the letter 'o' means "power off". Other functions are available. https://en.wikipedia.org/wiki/Magic_SysRq_key