Re: [systemd-devel] Howto detect a session start (and end) with systemd?

2012-06-30 Thread Stef Bon
Ok,

forget last message. I've found test-login.c, which gives all answers.

Stef

2012/6/30 Stef Bon stef...@gmail.com:
 Yes,

 thank you. It looks like a can use that. It just provides what I need.

 The monitor sd_login_monitor can provide a fd. What happens with this
 fd? Is there data readable?

 Stef

 2012/6/27 David Herrmann dh.herrm...@googlemail.com:
 Hi Stef

 On Mon, Jun 25, 2012 at 11:27 AM, Stef Bon stef...@gmail.com wrote:
 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).

 You can use the sd-login library. It does basically the same as you
 suggested. It watches the right directories for changes and notifies
 you. However, it also has some handy helpers to list all sessions so
 you can refresh your session-list every time the directory changes.
 See sd-login.h for more information.

 Regards
 David
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] Howto detect a session start (and end) with systemd?

2012-06-27 Thread David Herrmann
Hi Stef

On Mon, Jun 25, 2012 at 11:27 AM, Stef Bon stef...@gmail.com wrote:
 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).

You can use the sd-login library. It does basically the same as you
suggested. It watches the right directories for changes and notifies
you. However, it also has some handy helpers to list all sessions so
you can refresh your session-list every time the directory changes.
See sd-login.h for more information.

Regards
David
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] Howto detect a session start (and end) with systemd?

2012-06-25 Thread Stef Bon
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
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel