[systemd-devel] Shutdown notify

Michal Witanowski m.witanowski at samsung.com
Wed Aug 20 06:50:01 PDT 2014


The inhibit locks mechanism seems to be the solution, but another problem
appeared. I am unable to call Inhibit() method as non-root user. In the
documentation I read "Taking inhibitor locks is a privileged operation.
Depending on the action...". But how can I add a user to privileged users
group? Note that I do NOT have PolicyKit in the system...

BR,
Michal

-----Original Message-----
From: Lennart Poettering [mailto:lennart at poettering.net] 
Sent: Tuesday, August 19, 2014 1:40 PM
To: Michal Witanowski
Cc: systemd-devel at lists.freedesktop.org
Subject: Re: [systemd-devel] Shutdown notify

On Tue, 19.08.14 13:34, Michal Witanowski (m.witanowski at samsung.com) wrote:

> Hi all,
> 
> I would like to know if there is a possibility to get notified about
> upcoming shutdown/restart. For example:
> 
> .         Somebody executes "systemctl reboot" / "systemctl poweroff"
> 
> .         A callback function is called in my service before SIGTERM is
> triggered on ANY service.
> 
> .         After my callback returns, the systemd continues the
> reboot/shutdown process.
> 
>  
> 
> I suppose it's possible via dbus API, but I couldn't find any examples
> connected with this scenario.
> 
> Thanks in advance.

You can use logind's shutdown delay inhibit locks:

http://www.freedesktop.org/wiki/Software/systemd/inhibit/

Lennart

-- 
Lennart Poettering, Red Hat



More information about the systemd-devel mailing list