From 9061928e473b12c0d877741464799fd1f6fbf041 Mon Sep 17 00:00:00 2001 From: mudhorn Date: Mon, 25 Aug 2025 11:44:42 -0700 Subject: [PATCH] Update README.md --- README.md | 67 ++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 64 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index c8b0056..cc11d7a 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,60 @@ sudo crontab -u -e # 6. Add logrotate rule sudo tee /etc/logrotate.d/aredn-sync <<'EOF' -su drcit drcit +su +//.local/logs/aredn.log { + daily + rotate 7 + compress + delaycompress + missingok + notifempty + create 0640 +} +EOF +``` + +Done ✅ — your mirror will now stay up to date automatically. Replace with actual user & group (usually drcit drcit) and any with the correct *absolute* path (e.g. "/**home/drcit**/.local/logs/aredn.log {") + +--- + +## 🔧 How it works +1. **Sync**: runs `rsync` to mirror upstream firmware files into `$ROOT`. +2. **Patch**: replaces the default firmware URL in `afs/www/config.js` with your local mesh URL (`$NEW_URL`). +3. **Collect**: runs `afs/misc/collect.py` to regenerate JSON indexes. +4. **Log**: everything is written to `~/.local/logs/aredn.log`. + +--- + +## ⚙️ Variables to Edit +At the top of `sync.sh`, adjust these for your environment: + +```bash +ROOT="$HOME//aredn" # mirror root +AFS="$ROOT/afs" # firmware site files +LOG="$HOME/.local/logs/aredn.log" # log path +UPSTREAM="downloads.arednmesh.org::aredn_firmware" # rsync source +NEW_URL="http://n2drc-ls1.local.mesh/" # mesh URL to inject +``` + +Replace any with the correct path (e.g. "$HOME/**docker/fileserver/files**/aredn"). + +--- + +## 📅 Cron Job +To keep your mirror current, run the script daily: + +```cron +0 0 * * * ~/aredn/sync.sh >> ~/.local/logs/aredn.log 2>&1 +``` + +--- + +## 📂 Log Rotation +To prevent logs from growing indefinitely, add `/etc/logrotate.d/aredn-sync`: + +```conf +su /home/drcit/.local/logs/aredn.log { daily rotate 7 @@ -36,6 +89,14 @@ su drcit drcit delaycompress missingok notifempty - create 0640 drcit drcit + create 0640 } -EOF \ No newline at end of file +``` + +This rotates logs daily, keeps 7 days, and compresses older logs. Replace with the actual user & group (usually drcit drcit). + +--- + +## 📜 License +This project is licensed under the [MIT License](LICENSE). +You are free to use, modify, and share this script. Attribution to **DRCIT** is appreciated.