#!/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 /home/jas/bin/resend_error.py "hyperreal-borg" logger -t sync-remotes "Error during sync of hyperreal-borg" else 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 /home/jas/bin/resend_error.py "auxnc-96g-borg" logger -t sync-remotes "Error during sync of auxnc-96g-borg" else 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 /home/jas/bin/resend_error.py "mastodata" logger -t sync-remotes "Error during sync of mastodata" else logger -t sync-remotes "mastodata successfully synced" fi exit 0