Openbox – Shutting Down Computer from Openbox

debiangdmopenboxshutdown

I've recently installed Openbox,and read a guide that said the PC should be shut down via this command:

gdm-control --shutdown && openbox --exit

However, it seems a bit counter intuitive. Why would I shut the computer down first and then exit Openbox? How is that even possible?

Or is it maybe that gdm-control --shutdown just sends a message somewhere? What if the computer shuts down before Openbox can exit? Is this really "the right way"?

Info:

Link to Openbox guide: http://urukrama.wordpress.com/openbox-guide/
OS: Debian Linux 7.0

Best Answer

Make an alias like this. Then just type shut.

alias shut="su -c 'shutdown -h now'"

You need to be root to do it, that's why you first set the user to superuser (su), then issue the command (-c). The -h is for "halt" after shutdown, i.e., don't reboot (or do anything else).

Related Question