diff options
Diffstat (limited to 'remote/modules')
3 files changed, 24 insertions, 0 deletions
diff --git a/remote/modules/hardware-stats/data/etc/systemd/system/shutdown-usage-log.service b/remote/modules/hardware-stats/data/etc/systemd/system/shutdown-usage-log.service new file mode 100644 index 00000000..fc65fe9f --- /dev/null +++ b/remote/modules/hardware-stats/data/etc/systemd/system/shutdown-usage-log.service @@ -0,0 +1,11 @@ +[Unit] +Description=Gather statistics about this machine and send to boot server +DefaultDependencies=no +Before=shutdown.target +RefuseManualStart=yes + +[Service] +Type=oneshot +ExecStart=/opt/openslx/scripts/shutdown-system_usage_update +RemainAfterExit=yes + diff --git a/remote/modules/hardware-stats/data/etc/systemd/system/shutdown.target.wants/shutdown-usage-log.service b/remote/modules/hardware-stats/data/etc/systemd/system/shutdown.target.wants/shutdown-usage-log.service new file mode 120000 index 00000000..d94670ed --- /dev/null +++ b/remote/modules/hardware-stats/data/etc/systemd/system/shutdown.target.wants/shutdown-usage-log.service @@ -0,0 +1 @@ +../shutdown-usage-log.service
\ No newline at end of file diff --git a/remote/modules/hardware-stats/data/opt/openslx/scripts/shutdown-system_usage_update b/remote/modules/hardware-stats/data/opt/openslx/scripts/shutdown-system_usage_update new file mode 100755 index 00000000..dc9f8f73 --- /dev/null +++ b/remote/modules/hardware-stats/data/opt/openslx/scripts/shutdown-system_usage_update @@ -0,0 +1,12 @@ +#!/bin/ash + +. /opt/openslx/config +[ -z "$SLX_REMOTE_LOG" ] && exit 0 + +UUID=$(cat /run/system-uuid) + +[ -z "$UUID" ] && exit 1 + +curl -s --data-urlencode "type=~poweroff" --data-urlencode "uuid=$UUID" \ + "$SLX_REMOTE_LOG" > /dev/null 2>&1 + |
