Jan
Jan

Reputation: 425

GNOME: Inhibit shutdown while backup is running

System: Debian 7 32bit

I'm trying to prevent the shutdown of my laptop during backups (obnam), and I think I can use inhibit to do so.

I found information on how to do this here, but when I execute this in the python shell

import dbus
bus = dbus.SessionBus()
proxy = bus.get_object('org.gnome.SessionManager','/org/gnome/SessionManager')

I get the error
dbus.exceptions.DBusException: org.freedesktop.DBus.Error.ServiceUnknown: The name org.gnome.SessionManager was not provided by any .service files

list_names confirms that:

bus.list_names() dbus.Array([dbus.UTF8String('org.freedesktop.DBus'), dbus.UTF8String(':1.16'), dbus.UTF8String('org.gnome.Terminal.Display_0'), dbus.UTF8String(':1.14'), dbus.UTF8String(':1.15'), dbus.UTF8String('org.gnome.GConf'), dbus.UTF8String(':1.2')], signature=dbus.Signature('s'))

Q1: Why is org.gnome.SessionManager unavailable?
Q2: Are there other (GNOME-related) possibilities to prevent shutdown during execution of a backup?

Upvotes: 0

Views: 263

Answers (1)

Jan
Jan

Reputation: 425

I tried to use the dbus interface from a root shell, but the root user did not have a valid GNOME session (of course).

Running the same code as my own (logged-in) user gave the desired result.

Upvotes: 2

Related Questions