diff options
Diffstat (limited to 'remote/modules')
| -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 |
