mirror of
https://codeberg.org/hyperreal/admin-scripts
synced 2024-11-01 08:03:05 +01:00
Change sync destinations
This commit is contained in:
parent
b80e04397a
commit
4f2ce821a3
31
sync_remotes
31
sync_remotes
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user