42 lines
1.1 KiB
Markdown
42 lines
1.1 KiB
Markdown
### **📌 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.**
|