upload-result.sh 545 Bytes
Newer Older
Enrico Pozzobon committed
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
#!/bin/bash

i=$1

if [[ -z $AUTH_HEADER ]]; then
	echo "Please provide \$AUTH_HEADER";
	exit;
fi

if [[ -z $i ]]; then
    echo "Please provide index of result to send"
fi

echo "Fetching result $i...";
curl "http://localhost:5002/results/$i/results.json" -f -o result.json || {
	curl "http://localhost:5002/restart_test/$i"
	exit;
}

echo "Sending results $i...";
curl 'https://lwc.las3.de/admin/insert-result.php' \
    -f -H "$AUTH_HEADER" \
    --data "$(cat result.json)" || exit
echo "Sent.";

curl "http://localhost:5002/delete_test/$i"