services-ros1-xbee_mav/flash-devices-batch.sh

32 lines
803 B
Bash
Raw Normal View History

# flash-devices-batch.sh
# Expects .env file to have the following structure:
#
# DEVICES="
# /dev/ttyUSB0,230400
# /dev/ttyUSB1,230400
# /dev/ttyUSB2,230400
# "
#
#!/bin/sh
# Load environment variables from .env file
. ./.env
# Iterate over each device in the DEVICES string
for device in $DEVICES; do
# Split the device string into path and baud rate
DEVICE_PATH=$(echo $device | cut -d',' -f1)
BAUD_RATE=$(echo $device | cut -d',' -f2)
# Export the variables for docker-compose to use
export DEVICE_PATH
export BAUD_RATE
# Run docker-compose with the current device
docker compose -f docker-compose-flash-device.yml up --build
# Optionally, bring down the containers after each run
docker compose -f docker-compose-flash-device.yml down
done