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

42 lines
1.1 KiB
Markdown
Raw Permalink Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
### **📌 How to Use**
#### **1⃣ Create the Directory List File**
Example: `/opt/AZURE/dir2sync_list`
```plaintext
/opt/AZURE/BLOB > testcontainer115
/opt/AZURE/OTHERBLOB > testcontainer115b
/opt/AZURE/EXTRABLOB > testcontainer_extra
```
---
#### **2⃣ Run the Script**
```bash
./run_azcopy.sh /opt/AZURE/dir2sync_list true 20
```
- `true` → Enables logging.
- `20` → Limits bandwidth to **20 Mbps**.
---
#### **3⃣ Cron Job (Runs Every Hour)**
```bash
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.**