summaryrefslogtreecommitdiffstats
path: root/core/modules/hardware-stats
diff options
context:
space:
mode:
authorSimon Rettberg2022-09-28 09:44:01 +0200
committerSimon Rettberg2022-09-28 09:44:01 +0200
commite6e846adf361dd8a487f0b89623f239733742f98 (patch)
treef12de051b505c9ed18d68b81bd6b9dd602a03c35 /core/modules/hardware-stats
parent[pulseaudio] Run background service for unmuting everything (diff)
downloadmltk-e6e846adf361dd8a487f0b89623f239733742f98.tar.gz
mltk-e6e846adf361dd8a487f0b89623f239733742f98.tar.xz
mltk-e6e846adf361dd8a487f0b89623f239733742f98.zip
[hardware-stats] Try harder to submit shutdown event to slx-admin
Diffstat (limited to 'core/modules/hardware-stats')
l---------core/modules/hardware-stats/data/etc/systemd/system/shutdown.target.wants/stats-shutdown.service1
-rw-r--r--core/modules/hardware-stats/data/etc/systemd/system/stats-shutdown.service13
-rwxr-xr-xcore/modules/hardware-stats/data/opt/openslx/scripts/shutdown-system_usage_update6
3 files changed, 19 insertions, 1 deletions
diff --git a/core/modules/hardware-stats/data/etc/systemd/system/shutdown.target.wants/stats-shutdown.service b/core/modules/hardware-stats/data/etc/systemd/system/shutdown.target.wants/stats-shutdown.service
new file mode 120000
index 00000000..35ac58a7
--- /dev/null
+++ b/core/modules/hardware-stats/data/etc/systemd/system/shutdown.target.wants/stats-shutdown.service
@@ -0,0 +1 @@
+../stats-shutdown.service \ No newline at end of file
diff --git a/core/modules/hardware-stats/data/etc/systemd/system/stats-shutdown.service b/core/modules/hardware-stats/data/etc/systemd/system/stats-shutdown.service
new file mode 100644
index 00000000..5d36034a
--- /dev/null
+++ b/core/modules/hardware-stats/data/etc/systemd/system/stats-shutdown.service
@@ -0,0 +1,13 @@
+[Unit]
+Description=Send shutdown event to boot server
+# Try this as a dedicated service in addition to the ExecStop=
+# entry in the hardware-stats.service, as that one sometimes
+# doesn't trigger/reach the server :-(
+Wants=network.target
+Before=shutdown.target
+After=network.target
+
+[Service]
+Type=oneshot
+ExecStart=/opt/openslx/scripts/shutdown-system_usage_update
+
diff --git a/core/modules/hardware-stats/data/opt/openslx/scripts/shutdown-system_usage_update b/core/modules/hardware-stats/data/opt/openslx/scripts/shutdown-system_usage_update
index 31ac01a3..6df22843 100755
--- a/core/modules/hardware-stats/data/opt/openslx/scripts/shutdown-system_usage_update
+++ b/core/modules/hardware-stats/data/opt/openslx/scripts/shutdown-system_usage_update
@@ -1,5 +1,8 @@
#!/bin/ash
+# Already done/running? Consider success
+mkdir /run/openslx/shutdown.mutex || exit 0
+
. /opt/openslx/config
[ -z "$SLX_REMOTE_LOG" ] && exit 0
@@ -7,6 +10,7 @@ UUID=$(cat /etc/system-uuid)
[ -z "$UUID" ] && exit 1
-curl --retry 3 --retry-connrefused --max-time 3 --retry-max-time 10 -s --data-urlencode "type=~poweroff" --data-urlencode "uuid=$UUID" \
+curl --retry 3 --retry-connrefused --max-time 3 --retry-max-time 10 -s \
+ --data-urlencode "type=~poweroff" --data-urlencode "uuid=$UUID" \
"$SLX_REMOTE_LOG"