summaryrefslogtreecommitdiffstats
path: root/core/modules/hardware-stats
diff options
context:
space:
mode:
authorSimon Rettberg2019-04-03 18:24:47 +0200
committerSimon Rettberg2019-04-03 18:24:47 +0200
commita937f7a47a8838a692f434f778f47e607a569b8f (patch)
tree6662471ad9384b5bbcb6a0d05f1a5971676c54b0 /core/modules/hardware-stats
parent[xorg] Remove "set -e" (diff)
downloadmltk-a937f7a47a8838a692f434f778f47e607a569b8f.tar.gz
mltk-a937f7a47a8838a692f434f778f47e607a569b8f.tar.xz
mltk-a937f7a47a8838a692f434f778f47e607a569b8f.zip
[hardware-stats] Use ExecStop for shutdown notification
Try a different approach: Since out initial hardware-stats service logging the poweron event is a oneshot with RemainAfterExit set, make the shutdown reporting script its ExecStop line (and hope that this works reliably on shutdown).
Diffstat (limited to 'core/modules/hardware-stats')
-rw-r--r--core/modules/hardware-stats/data/etc/systemd/system/hardware-stats.service4
-rw-r--r--core/modules/hardware-stats/data/etc/systemd/system/shutdown-usage-log.service14
l---------core/modules/hardware-stats/data/etc/systemd/system/shutdown.target.wants/shutdown-usage-log.service1
-rwxr-xr-xcore/modules/hardware-stats/data/opt/openslx/scripts/shutdown-system_usage_update2
4 files changed, 3 insertions, 18 deletions
diff --git a/core/modules/hardware-stats/data/etc/systemd/system/hardware-stats.service b/core/modules/hardware-stats/data/etc/systemd/system/hardware-stats.service
index 1f893ab1..36d47986 100644
--- a/core/modules/hardware-stats/data/etc/systemd/system/hardware-stats.service
+++ b/core/modules/hardware-stats/data/etc/systemd/system/hardware-stats.service
@@ -1,11 +1,11 @@
[Unit]
Description=Gather statistics about this machine and send to boot server
-DefaultDependencies=no
-After=tmp.target mount-vm-store.service
+After=tmp.target mount-vm-store.service network.target
Wants=tmp.target
[Service]
Type=oneshot
ExecStart=/opt/openslx/scripts/systemd-hardware_stats
RemainAfterExit=yes
+ExecStop=/opt/openslx/scripts/shutdown-system_usage_update
diff --git a/core/modules/hardware-stats/data/etc/systemd/system/shutdown-usage-log.service b/core/modules/hardware-stats/data/etc/systemd/system/shutdown-usage-log.service
deleted file mode 100644
index 7143a597..00000000
--- a/core/modules/hardware-stats/data/etc/systemd/system/shutdown-usage-log.service
+++ /dev/null
@@ -1,14 +0,0 @@
-[Unit]
-Description=Tell server we're shutting down
-DefaultDependencies=no
-Before=shutdown.target
-Requires=network-online.target
-After=-.mount network-online.target
-RefuseManualStart=yes
-
-[Service]
-Type=oneshot
-ExecStartPre=/opt/openslx/scripts/shutdown-system_usage_update
-ExecStart=/bin/true
-RemainAfterExit=yes
-
diff --git a/core/modules/hardware-stats/data/etc/systemd/system/shutdown.target.wants/shutdown-usage-log.service b/core/modules/hardware-stats/data/etc/systemd/system/shutdown.target.wants/shutdown-usage-log.service
deleted file mode 120000
index d94670ed..00000000
--- a/core/modules/hardware-stats/data/etc/systemd/system/shutdown.target.wants/shutdown-usage-log.service
+++ /dev/null
@@ -1 +0,0 @@
-../shutdown-usage-log.service \ No newline at end of file
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 f163f39f..983a882e 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
@@ -7,6 +7,6 @@ UUID=$(cat /etc/system-uuid)
[ -z "$UUID" ] && exit 1
-curl --retry 3 --retry-connrefused -s --data-urlencode "type=~poweroff" --data-urlencode "uuid=$UUID" \
+curl --retry 3 --retry-connrefused --max-time 3 --max-time-retry 10 -s --data-urlencode "type=~poweroff" --data-urlencode "uuid=$UUID" \
"$SLX_REMOTE_LOG" > /dev/null 2>&1