[fdo] Detect my own session being closed

Ryan rymg19 at gmail.com
Thu Feb 6 05:49:24 UTC 2020


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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/freedesktop/attachments/20200205/c4c10d3d/attachment.htm>


More information about the freedesktop mailing list