[fdo] Detect my own session being closed

Ryan rymg19 at gmail.com
Thu Feb 6 14:38:05 UTC 2020


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.

On Thu, Feb 6, 2020, 7:10 AM Sergio Costas <rastersoft at gmail.com> wrote:

> 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).
>
> El 6/2/20 a las 6:49, Ryan escribió:
>
> 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.
>
> On Wed, Feb 5, 2020, 10:55 AM Rastersoft <rastersoft at gmail.com> wrote:
>
>> Hello:
>>
>> 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.
>>
>> My questions are:
>>
>> - Is it possible to mount an external hard disk, using udisk2, making it
>> accessible for all the users?
>> - If not, is it possible to mark a mounted partition as "umount on
>> session close"?
>> - 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?
>>
>> 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).
>>
>> Thanks in advance.
>>
>> --
>> Nos leemos
>>                  RASTER    (Linux user #228804)
>> raster at rastersoft.com              http://www.rastersoft.com
>> _______________________________________________
>> freedesktop mailing list
>> freedesktop at lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/freedesktop
>>
>
> --
> Nos leemos
> 		         RASTER    (Linux user #228804)raster at rastersoft.com              http://www.rastersoft.com
>
> _______________________________________________
> freedesktop mailing list
> freedesktop at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/freedesktop
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/freedesktop/attachments/20200206/85b2395b/attachment.htm>


More information about the freedesktop mailing list