Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 6e0abbe

Browse files
committedApr 17, 2024
Improvements
1 parent 0df2788 commit 6e0abbe

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed
 

‎example/tools/ota/ota_mass_upload.sh

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,13 +78,17 @@ if [ $otaids == "null" ]; then
7878
exit 0
7979
fi
8080

81+
correctlyfinished=0
8182
while [ $waittime -gt 0 ]; do
8283
echo "Waiting for $waittime seconds for OTA process to complete..."
8384
sleep 15
8485
waittime=$((waittime-15))
8586
# Check status of running processess...
86-
otastatusout=$(arduino-cloud-cli ota status --ota-ids $otaids --format json | grep in_progress | wc -l)
87-
if [ "$otastatusout" -eq 0 ]; then
87+
otastatuslines=$(arduino-cloud-cli ota status --ota-ids $otaids --format json)
88+
otastatusinpcnt=$(echo $otastatuslines | grep in_progress | wc -l)
89+
otastatuspencnt=$(echo $otastatuslines | grep pending | wc -l)
90+
if [[ $otastatusinpcnt -eq 0 && $otastatuspencnt -eq 0 ]]; then
91+
correctlyfinished=1
8892
break
8993
fi
9094
done
@@ -93,7 +97,7 @@ echo ""
9397
echo "Status report:"
9498
arduino-cloud-cli ota status --ota-ids $otaids
9599

96-
if [ $waittime -le 0 ]; then
100+
if [ $correctlyfinished -eq 1 ]; then
97101
echo "OTA process did not complete within the specified time for some boards"
98102
exit 1
99103
else

0 commit comments

Comments
 (0)
Please sign in to comment.