summaryrefslogtreecommitdiffstats
path: root/remote/modules/pvs2/data/opt/openslx/scripts/setup-pvsmgr
blob: 5531518ab86743d3c08616eefe4762713e669300 (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
28
29
30
#!/bin/ash

. /opt/openslx/config

# Try to get fresh version from server
CONF=
if [ -n "$SLX_PVS_CONFIG_URL" ]; then
	DST="$(mktemp)"
	wget -T 5 -O "${DST}" "$SLX_PVS_CONFIG_URL"
	[ -s "${DST}" ] && CONF="--config=${DST}"
fi

openbox &

timediff=5
counter=0

while [ $timediff -gt 3 ]; do
	start="$(date +%s)"
	/opt/openslx/bin/pvsmgr "$CONF" "$@"
	ret=$?
	[ "$ret" == "0" ] && break
	end="$(date +%s)"
	timediff=$(( end - start ))
	counter=$(( counter + 1 ))
	[ $counter -gt 8 ] && break
done

exit $ret