summaryrefslogtreecommitdiffstats
path: root/core/modules/hardware-stats/data/opt/openslx/scripts/systemd-hws_standby
blob: cee2bfd785aafe22575829d82fdb0ae19afebcc7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/bin/ash

# Running as root?
touch "/run" || exit 2

ACTION=$1

if [ "x$ACTION" != "xresume" ] && [ "x$ACTION" != "xsuspend" ]; then
	echo "Expecting resume or suspend as argument!" >&2
	exit 1
fi

. /opt/openslx/config

UUID=$(cat /etc/system-uuid)

echo "Submitting to $SLX_REMOTE_LOG"
if curl --retry 4 --retry-connrefused --data-urlencode "type=~$ACTION" --data-urlencode "uuid=$UUID" "$SLX_REMOTE_LOG" | grep -q "RESULT=0"; then
	echo "Success"
	exit 0
else
	echo "Failed..."
fi

echo "Giving up" >&2
exit 1