[Tutor] Complete Shutdown
Timo
timomlists at gmail.com
Tue Nov 2 10:47:44 CET 2010
On 01-11-10 21:01, Chris King wrote:
> Dear Tutors,
> How do I completely shutdown a computer without administrative
> rights using a simple python script.
I once came across the following when playing with 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")
This will shutdown your computer immediatly. You can substitute the
"Shutdown" method with "Suspend", "Hibernate" or "Reboot".
Cheers,
Timo
> Sincerely,
> Me, Myself, and I
> _______________________________________________
> Tutor maillist - Tutor at python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
More information about the Tutor
mailing list