title: Linux: Programatically shutdown or reboot computer from a user-level process
body: <p>How do I programatically trigger a system shutdown or reboot in Linux? Preferably without requiring elevated privileges.</p>
  
  <p>On older releases (e.g. Ubuntu 10.04) I could call HAL's <code>org.freedesktop.Hal.Device.SystemPowerManagement.Shutdown</code> or <code>Reboot</code> methods using D-Bus. See: <a href="http://people.freedesktop.org/~dkukawka/hal-spec-git/hal-spec.html#interface-device-systempower" rel="nofollow">http://people.freedesktop.org/~dkukawka/hal-spec-git/hal-spec.html#interface-device-systempower</a>.</p>
  
  <p>However HAL appears to be obsolete, and is not present in Ubuntu 12.10. What is the current best-practice for doing this?</p>