Change sync destinations

This commit is contained in:
Jeffrey Serio 2024-09-27 17:54:14 -05:00
parent b80e04397a
commit 4f2ce821a3

View File

@ -1,41 +1,28 @@
#!/usr/bin/env bash
# I use this on my FreeBSD NAS to pull data from remotes and mirror
# it on my NAS. It runs via cron every two days.
if [[ "$1" == "-q" ]]; then
exec >/dev/null 2>&1
fi
if ! zfs mount | awk '{print $2}' | grep "coffeeNAS" >/dev/null; then
if ! zpool import -f coffeeNAS; then
/home/jas/bin/resend_error.py "failed to import coffeeNAS pool"
logger -t sync-remotes "failed to import coffeeNAS pool"
exit 100
else
logger -t sync-remotes "coffeeNAS pool is imported"
fi
fi
if ! rsync -avz --delete root@hyperreal.coffee:/srv/borgbackup/hyperreal/ /coffeeNAS/borgbackup/repositories/hyperreal; then
if ! rsync -avz --delete root@hyperreal.coffee:/srv/borgbackup/hyperreal/ /mnt/borgbackup/hyperreal; then
/home/jas/bin/resend_error.py "hyperreal-borg"
logger -t sync-remotes "Error during sync of hyperreal-borg"
logger -t sync_remotes "Error during sync of hyperreal-borg"
else
logger -t sync-remotes "hyperreal-borg successfully synced"
logger -t sync_remotes "hyperreal-borg successfully synced"
fi
if ! rsync -avz --delete root@auxnc-96g:/srv/backup/auxnc-96g/ /coffeeNAS/borgbackup/repositories/auxnc-96g; then
if ! rsync -avz --delete root@auxnc-96g:/srv/backup/auxnc-96g/ /mnt/borgbackup/auxnc-96g; then
/home/jas/bin/resend_error.py "auxnc-96g-borg"
logger -t sync-remotes "Error during sync of auxnc-96g-borg"
logger -t sync_remotes "Error during sync of auxnc-96g-borg"
else
logger -t sync-remotes "auxnc-96g-borg successfully synced"
logger -t sync_remotes "auxnc-96g-borg successfully synced"
fi
if ! rsync -avz --delete root@hyperreal.coffee:/home/mastodon/live/public/system/ /coffeeNAS/mastodata; then
if ! rsync -avz --delete root@hyperreal.coffee:/home/mastodon/live/public/system/ /mnt/mastodata; then
/home/jas/bin/resend_error.py "mastodata"
logger -t sync-remotes "Error during sync of mastodata"
logger -t sync_remotes "Error during sync of mastodata"
else
logger -t sync-remotes "mastodata successfully synced"
logger -t sync_remotes "mastodata successfully synced"
fi
exit 0