summaryrefslogtreecommitdiffstats
path: root/core/modules/hardware-stats
diff options
context:
space:
mode:
authorSimon Rettberg2022-09-28 10:59:44 +0200
committerSimon Rettberg2022-09-28 10:59:44 +0200
commit7db4d32ae7674c0b5da4d72bd118c2c970290724 (patch)
treef3a2a9d564bd59846fb5c9ded149b661009f997e /core/modules/hardware-stats
parent[hardware-stats] Try harder to submit shutdown event to slx-admin (diff)
downloadmltk-7db4d32ae7674c0b5da4d72bd118c2c970290724.tar.gz
mltk-7db4d32ae7674c0b5da4d72bd118c2c970290724.tar.xz
mltk-7db4d32ae7674c0b5da4d72bd118c2c970290724.zip
[hardware-stats] Don't send usage/bootup event if shutting down
Diffstat (limited to 'core/modules/hardware-stats')
-rwxr-xr-xcore/modules/hardware-stats/data/opt/openslx/scripts/cron-system_usage_update3
-rwxr-xr-xcore/modules/hardware-stats/data/opt/openslx/scripts/systemd-hardware_report2
2 files changed, 5 insertions, 0 deletions
diff --git a/core/modules/hardware-stats/data/opt/openslx/scripts/cron-system_usage_update b/core/modules/hardware-stats/data/opt/openslx/scripts/cron-system_usage_update
index cd4f3ea9..832f2078 100755
--- a/core/modules/hardware-stats/data/opt/openslx/scripts/cron-system_usage_update
+++ b/core/modules/hardware-stats/data/opt/openslx/scripts/cron-system_usage_update
@@ -96,6 +96,9 @@ if $full; then
fi
fi
+# Bail out if we already sent the shutdown event to server
+# Do this right before the curl call to minimize odds for a race condition
+[ -e /run/openslx/shutdown.mutex ] && exit 0
curl --retry 3 --retry-connrefused -m 6 -s --data-urlencode "type=~runstate" --data-urlencode "uuid=$UUID" --data-urlencode "used=$USED" \
--data-urlencode "user=$Name" --data-urlencode "tmpsize=$TMP_SIZE" --data-urlencode "tmpfree=$TMP_FREE" \
--data-urlencode "id45size=$ID45_SIZE" --data-urlencode "id45free=$ID45_FREE" \
diff --git a/core/modules/hardware-stats/data/opt/openslx/scripts/systemd-hardware_report b/core/modules/hardware-stats/data/opt/openslx/scripts/systemd-hardware_report
index 09d8efc9..3354230f 100755
--- a/core/modules/hardware-stats/data/opt/openslx/scripts/systemd-hardware_report
+++ b/core/modules/hardware-stats/data/opt/openslx/scripts/systemd-hardware_report
@@ -58,6 +58,8 @@ report_hardware_info() {
if ! python3 /opt/openslx/system-check/collect_hw_info_json.py -p > "$jsonfile"; then
echo -n "" > "$jsonfile"
fi
+ # Bail out if a shutdown was triggered and submitted in the meantime
+ [ -e /run/openslx/shutdown.mutex ] && exit 0
# just assume the uuid/mac dumped are valid here (its checked often enough :))
echo -n "Submitting to '$SLX_REMOTE_LOG' ... "
curl --retry 4 --retry-connrefused --max-time 5 --retry-max-time 15 \