Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Possible Duplicate:
How do I restart /shutdown from a terminal?

In gdm I could use

 os.system("gdm-control --reboot && openbox --exit")

In a Python script.

What would the command be for lightdm?

share|improve this question

marked as duplicate by hexafraction, hbdgaf, Mik, Jorge Castro, Tom Brossman Sep 22 '12 at 16:16

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

2  
if you just want to shutdown the system from command line you can use sudo shutdown -h 0. Does that not work in you case? –  Aras Sep 22 '12 at 0:47

2 Answers 2

You can just do it from terminal by

sudo shutdown -h now // or you can schedule it by giving time to shutdown

Or you can use

sudo halt
share|improve this answer

I looked through the manpages and couldn't find anything in lightdm that would allow you to shtudown the computer. You could use dbus.

import dbus
bus = dbus.SystemBus()
bus_object = bus.get_object("org.freedesktop.Hal", "/org/freedesktop/Hal/devices/computer")
bus_object.Shutdown(dbus_interface="org.freedesktop.Hal.Device.SystemPowerManagement")

Which is explained here

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.