Skip to content

Commit 6b68536

Browse files
committed
added wait time for ota process completion
1 parent 0efcb1e commit 6b68536

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

tools/ota/ota_mass_upload.sh

+15
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ checkExecutable "arduino-cloud-cli"
1717
checkExecutable "jq"
1818
checkExecutable "sort"
1919
checkExecutable "uniq"
20+
checkExecutable "paste"
2021

2122
# Default wait time for OTA process to complete
2223
waittime=600
@@ -71,6 +72,20 @@ while [ $waittime -gt 0 ]; do
7172
echo "Waiting for $waittime seconds for OTA process to complete..."
7273
sleep 15
7374
waittime=$((waittime-15))
75+
# Check status of running processess...
76+
otastatusout=$(arduino-cloud-cli ota status --ota-ids $otaids --format json | grep in_progress | wc -l)
77+
if [ "$otastatusout" -eq 0 ]; then
78+
break
79+
fi
7480
done
7581

82+
echo ""
83+
echo "Status report:"
84+
arduino-cloud-cli ota status --ota-ids $otaids
85+
86+
if [ $waittime -le 0 ]; then
87+
echo "OTA process did not complete within the specified time for some boards"
88+
exit 1
89+
fi
90+
7691
exit 0

0 commit comments

Comments
 (0)