UNPKG

1.13 kBapplication/x-shView Raw
1#! /bin/bash
2# Authenticate then send a batch
3
4AGENT=./codegradxvmauthor.js
5HOSTNAME=vmauthor.codegradx.org
6HOSTIP=192.168.122.205
7
8[ -d tmp ] && rm -rf tmp
9mkdir -p tmp
10
11# Get credentials for author
12CREDENTIALS=tmp/fw4ex-author0.json
13wget -O $CREDENTIALS http://$HOSTIP/fw4exjson/0
14
15# Check credentials. Credentials are only valid a few hours so refresh
16# credentials for the rest of this script:
17$AGENT --ip=$HOSTIP --credentials=$CREDENTIALS --update-credentials || true
18
19# Fetch some URLs naming available exercises:
20EXERCISES=tmp/fw4ex-example.json
21wget -O $EXERCISES http://$HOSTIP/e/path/example
22
23# Extract the URL of the 1st exercise:
24EXOURL=$(sed -rne 's/^ *"safecookie": "(.*)", *$/\1/p' < $EXERCISES | head -n1)
25
26# Send an answer to this exercise (a C problem)
27$AGENT --ip=$HOSTIP \
28 --credentials=$CREDENTIALS \
29 --type=batch \
30 --xmldir=tmp \
31 --stuff=spec/oefgc.tgz --follow \
32 --exercise="$EXOURL" \
33 --offset=30 --timeout=10 --counter=400
34
35[ -f tmp/*-multiJobStudentReport.xml ] && \
36grep -q " finishedjobs='9' totaljobs='9'" < tmp/*-multiJobStudentReport.xml &&\
37echo OK
38
39# end of 30-batch.sh