<div dir="auto"><div>D-Bus exists for this. Given you want, wouldn't you still run into the problem of your app then needing to persist across multiple user sessions in order to remount everything? You can't really do that reliably without a system service.<br><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Feb 6, 2020, 7:10 AM Sergio Costas <<a href="mailto:rastersoft@gmail.com">rastersoft@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>
<div>The problem is that I don't want to
have a system service, because I would also need a communication
protocol, an arbitration algorithm... I think that there should be
an API in logind that would allow a program to block the logout
the same than it allows to block shutdown and reboot, and being
notified of that. In fact, sometimes I receive a notification in
Gnome Shell telling me that Thunderbird is still running and can't
close the session... How can I do that? (if it also allows me to
detect it and do what I want, of course).<br>
</div>
<div><br>
</div>
<div>El 6/2/20 a las 6:49, Ryan escribió:<br>
</div>
<blockquote type="cite">
<div dir="auto">I think what you really want is a system service
that talks to your backup app. That way, it can run across user
sessions, thus being able to detect session opening, leaving,
etc.</div>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Wed, Feb 5, 2020, 10:55 AM
Rastersoft <<a href="mailto:rastersoft@gmail.com" target="_blank" rel="noreferrer">rastersoft@gmail.com</a>> wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">
<div>Hello:</div>
<div><br>
</div>
<div>I created a backup program that uses an external HD to
do the backups, and it is designed to allow several users
to share the same hard disk by storing each backup in a
different folder. To ensure that the backups are always
made, it automatically mounts the backup hard disk when it
detects it (using udisk2 DBus interface). The first
problem is that if the backup program of the user A mounts
the disk, only user A can access it. The second problem is
that, if user closes its session as user A and opens a new
session as user B, the external hard disk is still mounted
as the user A, so the backup program of user B can't
access it unless user B manually unmounts it.</div>
<div><br>
</div>
<div>My questions are:</div>
<div><br>
</div>
<div>- Is it possible to mount an external hard disk, using
udisk2, making it accessible for all the users?</div>
<div>- If not, is it possible to mark a mounted partition as
"umount on session close"?</div>
<div>- If not, is it possible to detect when my session is
being closed, to make the backup program to umount the
partition, thus allowing other users to use it?</div>
<div><br>
</div>
<div>About this last question: I already tried to connect to
the SessionRemoved signal from logind, but with no luck: I
receive the signal when other users close their session,
but my program is killed before it can process the signal.
Also I tried to use onexit(), atexit(), and GApplication's
close signals, but also with no luck: the code isn't
called (I'm using GTK, and the program always dies with a
'broken pipe' message when the session is closed).</div>
<div><br>
</div>
<div>Thanks in advance.<br>
</div>
<div><br>
-- <br>
<div dir="ltr" data-smartmail="gmail_signature">Nos leemos<br>
RASTER (Linux user #228804)<br>
<a href="mailto:raster@rastersoft.com" rel="noreferrer noreferrer" target="_blank">raster@rastersoft.com</a>
<a href="http://www.rastersoft.com" rel="noreferrer noreferrer" target="_blank">http://www.rastersoft.com</a></div>
</div>
</div>
_______________________________________________<br>
freedesktop mailing list<br>
<a href="mailto:freedesktop@lists.freedesktop.org" rel="noreferrer noreferrer" target="_blank">freedesktop@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/freedesktop" rel="noreferrer noreferrer noreferrer" target="_blank">https://lists.freedesktop.org/mailman/listinfo/freedesktop</a><br>
</blockquote>
</div>
</blockquote>
<p><br>
</p>
<pre cols="72">--
Nos leemos
RASTER (Linux user #228804)
<a href="mailto:raster@rastersoft.com" target="_blank" rel="noreferrer">raster@rastersoft.com</a> <a href="http://www.rastersoft.com" target="_blank" rel="noreferrer">http://www.rastersoft.com</a>
</pre>
</div>
_______________________________________________<br>
freedesktop mailing list<br>
<a href="mailto:freedesktop@lists.freedesktop.org" target="_blank" rel="noreferrer">freedesktop@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/freedesktop" rel="noreferrer noreferrer" target="_blank">https://lists.freedesktop.org/mailman/listinfo/freedesktop</a><br>
</blockquote></div></div></div>