3

I have been playing with Dbus (versions 1.4.0, in Ubuntu 10.10 and 1.4.14) and ConsoleKit (versions 0.4.1 and 0.4.5) to reboot or halt my computer without being a superuser. Everything works fine in both versions.

If I execute the commands detailed in this page, the systems halts or reboots without troubles. Now, what I'd like to know is whether I can schedule that halt/reboot at a certain time (still using Dbus/ConsoleKit). Something like the shutdown command can do (shutdown -h 10:56) Is that possible?

I can always use an at or cron, but if I can do it straight with dbus, that'd be perfect.

jasonwryan
  • 71,734
  • 34
  • 193
  • 226
Savir
  • 1,221
  • 1
  • 17
  • 24

1 Answers1

0

Calling halt, shutdown or reboot from the cron is cleaner solution, because d-bus is just messaging system, and cron already calls as a root. But if you need to tell about the shutdown to another applications thru d-bus, try calling this:

dbus-send --system --print-reply --dest="org.freedesktop.ConsoleKit" /org/freedesktop/ConsoleKit/Manager org.freedesktop.ConsoleKit.Manager.Stop
dmnc
  • 178
  • 1
  • 10