diff --git a/run_azcopy-multi-dir-multi-container.sh b/run_azcopy-multi-dir-multi-container.sh index bba373d..c855758 100755 --- a/run_azcopy-multi-dir-multi-container.sh +++ b/run_azcopy-multi-dir-multi-container.sh @@ -5,10 +5,11 @@ cd /opt/AZURE || exit 1 # Configurable variables # Basic variables need for this scrip[t to operate correctly. -BUSINESS_HOURS_START=10 +BUSINESS_HOURS_START=16 BUSINESS_HOURS_END=20 AZURE_ACCOUNT="" AZURE_SAS="" + LOCK_FILE="/tmp/run_azcopy.lock" # Arguments @@ -90,23 +91,15 @@ for LINE in "${SYNC_JOBS[@]}"; do DEST_URL="$AZURE_ACCOUNT/$DEST_CONTAINER" echo "Syncing $SOURCE_DIR to container: $DEST_CONTAINER" | tee -a "$LOG_FILE" - # Check if the container exists by attempting to write a small test file - TEST_FILE="$SOURCE_DIR/.azcopy_test_file" - touch "$TEST_FILE" - azcopy cp "$TEST_FILE" "$DEST_URL?$AZURE_SAS" > /dev/null 2>&1 - if [[ $? -ne 0 ]]; then - echo "ERROR: Destination container $DEST_CONTAINER does not exist or is inaccessible. Exiting." | tee -a "$LOG_FILE" - rm -f "$TEST_FILE" - rm -f "$LOCK_FILE" - exit 1 - fi - rm -f "$TEST_FILE" - # Run azcopy in the background (one directory at a time) if [[ "$LOGGING" == "true" ]]; then - azcopy sync "$SOURCE_DIR" "$DEST_URL?$AZURE_SAS" --recursive --cap-mbps "$BANDWIDTH_CAP" | tee -a "$LOG_FILE" & +# @05-03-2025 testing copy instead of sync due to issues after archiving files in the blob +# azcopy sync "$SOURCE_DIR" "$DEST_URL?$AZURE_SAS" --recursive --cap-mbps "$BANDWIDTH_CAP" | tee -a "$LOG_FILE" & + azcopy copy "$SOURCE_DIR" "$DEST_URL?$AZURE_SAS" --overwrite false --recursive --cap-mbps "$BANDWIDTH_CAP" | tee -a "$LOG_FILE" & else - azcopy sync "$SOURCE_DIR" "$DEST_URL?$AZURE_SAS" --recursive --cap-mbps "$BANDWIDTH_CAP" > /dev/null 2>&1 & +# @05-03-2025 testing copy instead of sync due to issues after archiving files in the blob +# azcopy sync "$SOURCE_DIR" "$DEST_URL?$AZURE_SAS" --recursive --cap-mbps "$BANDWIDTH_CAP" > /dev/null 2>&1 & + azcopy copy "$SOURCE_DIR" "$DEST_URL?$AZURE_SAS" --overwrite false --recursive --cap-mbps "$BANDWIDTH_CAP" > /dev/null 2>&1 & fi AZCOPY_PID=$!