summaryrefslogblamecommitdiffstats
path: root/core/modules/hardware-stats/data/opt/openslx/scripts/systemd-hws_standby
blob: a92a004db70917f7450aea4b1c734edd9c4e431b (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12











                                                                    

                     













                                                                                                                           
#!/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)

for DELAY in 1 1 2 3 5 8 0; do
	echo "Submitting to $SLX_REMOTE_LOG"
	if curl --data-urlencode "type=~$ACTION" --data-urlencode "uuid=$UUID" "$SLX_REMOTE_LOG" | grep -q "RESULT=0"; then
		echo "Success"
		exit 0
	fi
	echo "Failed..."
	sleep "$DELAY"
done
echo "Giving up" >&2
exit 1