diff options
Diffstat (limited to 'detonate.sh')
-rwxr-xr-x | detonate.sh | 23 |
1 files changed, 23 insertions, 0 deletions
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" |