diff options
author | Simon Rettberg | 2016-08-03 14:50:57 +0200 |
---|---|---|
committer | Simon Rettberg | 2016-08-03 14:50:57 +0200 |
commit | 593ff83002ecbcbc81f5f7842554bb56e3db62ea (patch) | |
tree | dd76d6bee5b6ee3bd29b3a53e471b7c202180cf5 | |
parent | [run-virt/vmware] Patch resolution into vmx if it's an "odd one" (diff) | |
download | tm-scripts-593ff83002ecbcbc81f5f7842554bb56e3db62ea.tar.gz tm-scripts-593ff83002ecbcbc81f5f7842554bb56e3db62ea.tar.xz tm-scripts-593ff83002ecbcbc81f5f7842554bb56e3db62ea.zip |
[hardware-stats] Only consider display :0 for usage detection
-rwxr-xr-x | remote/modules/hardware-stats/data/opt/openslx/scripts/cron-system_usage_update | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/remote/modules/hardware-stats/data/opt/openslx/scripts/cron-system_usage_update b/remote/modules/hardware-stats/data/opt/openslx/scripts/cron-system_usage_update index 9ab77f4f..74486508 100755 --- a/remote/modules/hardware-stats/data/opt/openslx/scripts/cron-system_usage_update +++ b/remote/modules/hardware-stats/data/opt/openslx/scripts/cron-system_usage_update @@ -10,16 +10,17 @@ UUID=$(cat "/run/system-uuid") [ -z "$UUID" ] && exit 1 USED=0 +Name= for SESSION in $(loginctl | awk '{print $1}'); do unset Display Remote State - eval $(loginctl -p Display -p Remote -p State -p Class show-session "$SESSION") - if [ -n "$Display" ] && [ "$Remote" = "no" ] && [ "$State" = "active" -o "$State" = "online" ] && [ "$Class" = "user" ]; then - USED=1 - break; + eval $(loginctl -p Display -p Remote -p State -p Class -p Name show-session "$SESSION") + if [ "$Display" = ":0" ] && [ "$Remote" = "no" ] && [ "$State" = "active" -o "$State" = "online" ] && [ "$Class" = "user" ]; then + USED=1 # We only consider sessions on the primary display, which should always be the case + break fi done curl -s --data-urlencode "type=~runstate" --data-urlencode "uuid=$UUID" --data-urlencode "used=$USED" \ - "$SLX_REMOTE_LOG" > /dev/null 2>&1 + --data-urlencode "user=$Name" "$SLX_REMOTE_LOG" > /dev/null 2>&1 |