mkdir -p "${WS_WATCHER}"
cd "${WS_WATCHER}"
touch next_dwn
-i=$(cat next_dwn)
-test -n "$i" || i=1
+next=$(cat next_dwn)
+test -n "$next" || next=1
+# Allocate 300 numbers in case this script terminates during dispatch
+echo $((next+300)) > "${WS_WATCHER}/next_dwn" || die "Write failed: ${WS_WATCHER}/next_dwn"
+# Append to unique_dispatch in case previous job failed
if [ -f manual_urls ];
then
- sort -u modified_urls manual_urls > unique_dispatch
+ sort -u modified_urls manual_urls >> unique_dispatch
else
- cp modified_urls unique_dispatch
+ cat modified_urls >> unique_dispatch
fi
while read -r url
do
for i in $(tsmaster | awk -v URL="$url" '$2 ~ "running" && $0 ~ URL {print $1}'); do kill "$(tsmaster -p "$i")"; done
for target in "minnow32" "minnow64" "odroid"
do
- rm -rf "${WS_DOWNLOAD}/$i"
- mkdir -p "${WS_DOWNLOAD}/$i"
- cd "${WS_DOWNLOAD}/$i"
+ rm -rf "${WS_DOWNLOAD}/$next"
+ mkdir -p "${WS_DOWNLOAD}/$next"
+ cd "${WS_DOWNLOAD}/$next"
# Download image for $target
nr=$(tsmaster -L "DOWNLOAD_IMAGE_${target}" python "${TSP_DIR}/scripts/download_image.py" --log=INFO -t "${target}" "$url")
nr=$(tsmaster -D "$nr" -L "IMAGE_TEST" \
- sh "${TSP_DIR}/jobs/img_test_common.sh" "$i" "$target")
- i=$((i+1))
+ sh "${TSP_DIR}/jobs/img_test_common.sh" "$next" "$target")
+ next=$((next+1))
done
done < unique_dispatch
cd "${WS_WATCHER}"
-echo "$i" > "next_dwn"
+echo "$next" > "${WS_WATCHER}/next_dwn" || die "Write failed: ${WS_WATCHER}/next_dwn"
rm -f unique_dispatch modified_urls manual_urls