summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathan Bauer2015-04-07 15:44:44 +0200
committerJonathan Bauer2015-04-07 15:44:44 +0200
commitb34bc0e6f97ca55b7d6c85b710f9bc40783c41e9 (patch)
treed76fa2c10e1be85ab488481265b6615c809616e4
parent[pam-common-share] fix bad variable name and typo (diff)
downloadtm-scripts-b34bc0e6f97ca55b7d6c85b710f9bc40783c41e9.tar.gz
tm-scripts-b34bc0e6f97ca55b7d6c85b710f9bc40783c41e9.tar.xz
tm-scripts-b34bc0e6f97ca55b7d6c85b710f9bc40783c41e9.zip
[pam] fix annoying errors when logging out of ttys
loginctl only show graphically logged in users, not on ttys, therefore loginctl will fail when logging out of a tty and dump errors on stderr. Soon everything will be different but still cosmetics :)
-rwxr-xr-xremote/modules/pam/data/opt/openslx/scripts/pam_script_ses_close4
1 files changed, 2 insertions, 2 deletions
diff --git a/remote/modules/pam/data/opt/openslx/scripts/pam_script_ses_close b/remote/modules/pam/data/opt/openslx/scripts/pam_script_ses_close
index 4fc2ce6a..9332e0a6 100755
--- a/remote/modules/pam/data/opt/openslx/scripts/pam_script_ses_close
+++ b/remote/modules/pam/data/opt/openslx/scripts/pam_script_ses_close
@@ -26,7 +26,7 @@ if [ -d "/opt/openslx/scripts/pam_script_ses_close.d" ]; then
done
fi
-OPENSESSION=$(loginctl show-user "$PAM_USER" | grep "Sessions=" | cut -c 10-)
+OPENSESSION=$(loginctl show-user "$PAM_USER" 2>/dev/null| grep "Sessions=" | cut -c 10-)
SESSIONCOUNT=$(echo "$OPENSESSION" | wc -w)
# When using su/sudo there is no session created, so count up by one
if [ "x$PAM_SERVICE" = "xsu" -o "x$PAM_SERVICE" = "xsudo" ]; then
@@ -55,7 +55,7 @@ if [ "$SESSIONCOUNT" -le "1" ]; then
done
# just to be sure we check if there's no other open session in the meantime
- OPEN2=$(loginctl show-user "$PAM_USER" | grep "Sessions=" | cut -c 10-)
+ OPEN2=$(loginctl show-user "$PAM_USER" 2>/dev/null | grep "Sessions=" | cut -c 10-)
if [ -z "$OPEN2" -o "x$OPENSESSION" = "x$OPEN2" ]; then