[systemd-devel] Howto detect a session start (and end) with systemd?
Stef Bon
stefbon at gmail.com
Mon Jun 25 02:27:20 PDT 2012
Hi,
I'm working on a construction which creates "workspaces" for a user
when he/she logs in.
These workspaces are directories with vritual directories managed by a
FUSE fs, with access to mountable resources like harddisks, usb
sticks, cdroms but also network services like smb shares.
In practice this will mean for example the creation of the maps
Devices
and
Network
in the homedir of the user, and access to local block devices is able
when accessing Devices, and a browseable network map is created in
Network. The first type of workspace works, but still in alpha, more
testing is required, and currently working on the network map enabling
the detection of smb workgroups, servers and shares on the fly.
Mounting is done by the automounter, using for example mount.cifs for
the smb shares, and contents is redirected to the location where the
resource is available in the workspace by the FUSE fs.
This construction does not depend on any gui or desktop environment,
like KDE or Gnome, and works on filesystem level. Anyone - also when
loging in from text console - can use this.
Now this works already very good. I've one program (fuse-workspace)
which watches the sessions starts and ends. I've made this work by
adding the pam module pam_script to the relevant pam files, and make
that module run scripts which maintain a usersessions file.
Fuse-workspace watches that file for changes.
This works, and I'm keeping this for a "always working fallback", but
I would like to know how to do this with systemd, since this is doing
that also, and doing things double is never a good thing on systems
with systemd installed.
For example: is watching the directory /run/systemd/sessions by
inotify a good idea? (inotify is already used).
Or do I have to write a dbus connection?
Stef
More information about the systemd-devel
mailing list