<div dir="ltr"><span style="font-family:arial,sans-serif;font-size:13px">Hello folks,</span><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">Apologies if anybody is getting this message twice; I originally posted on <a href="mailto:dbus@lists.freedesktop.org" target="_blank">dbus@lists.freedesktop.org</a> and was directed here. </div>
<div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">I am attempting to listen to the SessionRemoved signal from the <a href="http://www.freedesktop.org/wiki/Software/systemd/logind/" target="_blank">login manager</a>. I have no trouble in the case where the user logs out and waits for ~15 seconds before shutting down, but when the user shuts down the system without first logging out I don't hear the SessionRemoved signal in time. I would've thought that inhibiting shutdown (by calling the <a href="http://www.freedesktop.org/wiki/Software/systemd/inhibit/" target="_blank">Inhibit method of the login manager</a>) would be the appropriate way to keep my process alive long enough to record the SessionRemoved signal before my process gets killed. Apparently that is not the case though. I am fairly certain that I am actually inhibiting shutdown, because my process shows up when I call ListInhibitors in <a href="https://wiki.gnome.org/action/show/Apps/DFeet" target="_blank">D-Feet</a>.</div>
<div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">In case it's relevant, I'm using the delay mode of the inhibit method, and my process runs as root. To test whether my process was running in the user session, I called <a href="http://linux.about.com/library/cmd/blcmdl2_getsid.htm" target="_blank">getsid (0)</a>. It returned the PID of my process, which does not match the session ID of the SessionRemoved signals I was able to record. Is this a legitimate way to verify that my process isn't running in the user session? My original assumption was that my process couldn't possibly be in the user session because I am able to hear the SessionRemoved signal when the user logs out and waits for ~15 seconds. Is that a bad assumption to make?</div>
<div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">I was advised that some shutdown commands bypass logind, so I tried shutting down several different ways (systemctl shutdown, shutdown now, sudo shutdown now, calling Shutdown method on org.gnome.SessionManager from D-Feet, and the typical GUI way). In all cases I got the same result: I didn't hear the SessionRemoved signal. If anyone has any suggestions on how to debug this or knows what I am missing here, that would be greatly appreciated. Please let me know if any additional details would be helpful.</div>
<div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">Be well,</div><div style="font-family:arial,sans-serif;font-size:13px">Kurt</div><div><br></div>
--<br>
<div dir="ltr"><span><span style="font-size:15px;font-family:Arial;color:rgb(183,183,183);vertical-align:baseline;white-space:pre-wrap;background-color:transparent">Kurt von Laven | Endless Mobile | </span><a href="http://endlessm.com/" style="text-decoration:none" target="_blank"><span style="font-size:15px;font-family:Arial;color:rgb(183,183,183);text-decoration:underline;vertical-align:baseline;white-space:pre-wrap;background-color:transparent">EndlessM.com</span></a></span><br>
</div>
</div>