#!/bin/bash # chain-mirrors.sh # Run all mirror syncs sequentially with cleanup (--delete). LOGDIR="/home/mirror/logs" mkdir -p "$LOGDIR" run_sync() { local name="$1" local cmd="$2" echo "[*] Starting $name at $(date)" eval "$cmd" >> "$LOGDIR/${name}-mirror-sync.log" 2>&1 local status=$? if [ $status -eq 0 ]; then echo "[+] $name finished successfully at $(date)" else echo "[!] $name FAILED with code $status at $(date)" fi } # Mirrors (adjust to your actual paths/servers) run_sync "arch" "rsync -avH --partial --delete --delete-delay --safe-links --hard-links --numeric-ids --timeout=300 --contimeout=60 --info=progress2 rsync://mirror.csclub.uwaterloo.ca/archlinux /brimstone2a/mirror/archlinux" run_sync "gentoo" "rsync -avH --partial --safe-links --hard-links --numeric-ids --timeout=300 --contimeout=60 --info=progress2 rsync://masterdistfiles.gentoo.org/gentoo/ /brimstone2a/mirror/gentoo" #run_sync "portage" "rsync -avH --partial --delete --delete-delay --safe-links --hard-links --numeric-ids --timeout=300 --contimeout=60 --info=progress2 rsync://rsync.ca.gentoo.org/gentoo-portage/ /brimstone1a/mirror/portage" run_sync "slackware" "rsync -avH --partial --delete --delete-delay --safe-links --hard-links --numeric-ids --timeout=300 --contimeout=60 --info=progress2 rsync://rsync.osuosl.org/slackware/ /brimstone2a/mirror/slackware" run_sync "hbsd" "rsync -avH --partial --delete --delete-delay --safe-links --hard-links --numeric-ids --timeout=300 --contimeout=60 --info=progress2 rsync://rsync.hardenedbsd.org/all /brimstone2a/mirror/hardenedbsd" #run_sync "rocky" "rsync -avH --partial --delete --delete-delay --safe-links --hard-links --numeric-ids --timeout=300 --contimeout=60 --info=progress2 rsync://mirror.dst.ca/rocky /brimstone1a/mirror/rocky" run_sync "alma" "rsync -avH --partial --delete --delete-delay --safe-links --hard-links --numeric-ids --timeout=300 --contimeout=60 --info=progress2 rsync://plug-mirror.rcac.purdue.edu/almalinux /brimstone3a/mirror/alma" run_sync "void" "rsync -avH --partial --delete --delete-delay --safe-links --hard-links --numeric-ids --timeout=300 --contimeout=60 --info=progress2 rsync://alpha.de.repo.voidlinux.org/voidlinux/ /brimstone3a/mirror/void" run_sync "debian" "/root/archvsync/bin/ftpsync sync:all" echo "[*] All mirrors complete at $(date)"