summaryrefslogtreecommitdiffstats
path: root/server/modules/pam-freiburg
diff options
context:
space:
mode:
authorJonathan Bauer2013-08-15 15:18:33 +0200
committerJonathan Bauer2013-08-15 15:18:33 +0200
commit2e883c8b850016fa20efc56318ab72a9fa00a4d4 (patch)
tree7caa1a6fb974b55856a451e54b75550852ca7eea /server/modules/pam-freiburg
parent[rootfs-stage31] renamed setup_network to setup-network (diff)
downloadtm-scripts-2e883c8b850016fa20efc56318ab72a9fa00a4d4.tar.gz
tm-scripts-2e883c8b850016fa20efc56318ab72a9fa00a4d4.tar.xz
tm-scripts-2e883c8b850016fa20efc56318ab72a9fa00a4d4.zip
[pam-freiburg] hacky umounting of home directory upon closing of last session
Diffstat (limited to 'server/modules/pam-freiburg')
-rwxr-xr-xserver/modules/pam-freiburg/opt/openslx/scripts/pam_script_ses_close11
1 files changed, 7 insertions, 4 deletions
diff --git a/server/modules/pam-freiburg/opt/openslx/scripts/pam_script_ses_close b/server/modules/pam-freiburg/opt/openslx/scripts/pam_script_ses_close
index 2b6f6105..27620ee0 100755
--- a/server/modules/pam-freiburg/opt/openslx/scripts/pam_script_ses_close
+++ b/server/modules/pam-freiburg/opt/openslx/scripts/pam_script_ses_close
@@ -1,9 +1,12 @@
#!/bin/bash
-export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/openslx/bin:/opt/openslx/sbin:/opt/openslx/usr/bin:/opt/openslx/usr/sbin"
-
[ ! -z "$SLX_DEBUG" ] && echo "[$PAM_TYPE] Closing session for $PAM_USER"
-# TODO check if its the last session of the user.
+OPENSESSIONS=$(loginctl|grep $PAM_USER|wc -l)
+[ ! -z "$SLX_DEBUG" ] && echo "User $PAM_USER has $OPENSESSIONS open sessions."
-[ $(id -g $PAM_USER) -ge 1000 ] && umount /home/$PAM_USER
+if [ "x$OPENSESSIONS" == "x1" ]; then
+ # assume its last session, start watchdog in background
+ [ ! -z "$SLX_DEBUG" ] && echo "Last session beeing closed..."
+ ( while true; do sleep 1; if [ "x$(loginctl |grep $PAM_USER)" == "x" ]; then [ $(id -g $PAM_USER) -ge 1000 ] && umount /home/s8jobaue; fi; done) &
+fi