Files
azcopy_sync/README.md
2025-02-21 14:54:03 +00:00

1.1 KiB
Raw Blame History

📌 How to Use

1 Create the Directory List File

Example: /opt/AZURE/dir2sync_list

/opt/AZURE/BLOB > testcontainer115
/opt/AZURE/OTHERBLOB > testcontainer115b
/opt/AZURE/EXTRABLOB > testcontainer_extra

2 Run the Script

./run_azcopy.sh /opt/AZURE/dir2sync_list true 20
  • true → Enables logging.
  • 20 → Limits bandwidth to 20 Mbps.

3 Cron Job (Runs Every Hour)

0 * * * * /opt/AZURE/run_azcopy.sh /opt/AZURE/dir2sync_list true 20

Key Features

Prevents multiple instances using a lock file (/tmp/run_azcopy.lock).
Reads a file with directory-to-container mappings.
Validates each source directory before syncing.
Checks if the destination container exists (test write).
Stops immediately on any error (clean runs only).
Monitors azcopy every 30 seconds and stops if business hours begin.
Processes all directories sequentially using an array (fixing loop issue).
Uses one log file for the entire run.