From 41e897f4945aaf8fbcdf0b12ac2f08c5e6ae0458 Mon Sep 17 00:00:00 2001 From: doc Date: Mon, 30 Jun 2025 20:11:52 +0000 Subject: commit of legacy code --- detonate.sh | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100755 detonate.sh (limited to 'detonate.sh') diff --git a/detonate.sh b/detonate.sh new file mode 100755 index 0000000..5defdae --- /dev/null +++ b/detonate.sh @@ -0,0 +1,23 @@ +#!/bin/bash +# This script finds and blows away directory landmines in a MinIO-mounted filesystem +# where files are supposed to go but directories already exist. Use with caution. + +LOG="/tmp/minio_detonation.log" +ERROR_LOG="/tmp/rclonemasto-dump.log" +TARGET_BASE="/assets/minio-data/mastodon" + +echo "[*] Scanning for blocking directories... 💣" | tee "$LOG" + +grep 'is a directory' "$ERROR_LOG" | \ +awk -F': open ' '{print $2}' | \ +sed 's/: is a directory//' | \ +sort -u | while read -r bad_path; do + if [ -d "$bad_path" ]; then + echo "[💥] Nuking: $bad_path" | tee -a "$LOG" + rm -rf "$bad_path" + else + echo "[✔️] Skipped (not a dir): $bad_path" | tee -a "$LOG" + fi +done + +echo "[✅] All blocking directories removed. Re-run rclone and finish the war." | tee -a "$LOG" -- cgit v1.2.3