Hi Olvier,
just saw your post here. Thanks for the new page and the information provided. I am still a bit puzzled about the 'userID' <-> 'user' thing. Hence, I would like to share my (working) shell script, which cycles over a list of specific jobs and executes the refreshes (still with 'user'):
#/bin/bash
AWK=$(which awk)
CURL="/usr/bin/curl -b /tmp/cookies.txt -c /tmp/cookies.txt -H"
TYPE="\"Content-Type: application/json\""
POST="-X POST -s"
GET="-X GET -s"
PUT="-X PUT -s"
URL="
http://localhost:8080/datafari-mcf-api-service/json"
LOGIN="{ user: admin, password: XXXXX }"
REDIRECT="> /dev/null 2>&1"
DATE="$(which date)"
LOG="$HOME/log/datafari.log"
if [ "$1" = "minimal" ]; then
START="startminimal"
else
START="start"
fi
JOBS=" 1490194448568
1490195083592
1490282191612
1492506656198
1490177300785
1490177459915
1486820638564
1486840669411
1490177651005
1486820638502" # List of job numbers
# Start clean
rm /tmp/cookies.txt > /dev/null 2>&1
rm $LOG > /dev/null 2>&1
# Cycle over jobs
for JOB in $JOBS; do
echo "[$($DATE)]: Starting Job $JOB ($START)" >> "$LOG"
# LOGIN
$CURL "$TYPE" $POST --data "$LOGIN" $URL/LOGIN > /dev/null
# Start JOB
$CURL "$TYPE" $PUT "$URL/$START/$JOB" > /dev/null
# Loop for output
STATUS=running
while [ "$STATUS" != "done" ]; do
sleep 5
# Refresh LOGIN
$CURL "$TYPE" $POST --data "$LOGIN" $URL/LOGIN > /dev/null
# Check JOB status
STATUS=$($CURL "$TYPE" $GET "$URL/jobstatuses/$JOB" | $AWK -F'"status":"' '{ print $2 }' | $AWK -F\" ' { print $1 }')
done
rm /tmp/cookies.txt
echo "[$($DATE)]: finished" >> "$LOG"
done
exit 0