ythel backup tweaks

This commit is contained in:
dctrud 2020-10-06 17:07:41 -05:00
parent db0a299856
commit 2b3943a88b
1 changed files with 10 additions and 18 deletions

View File

@ -1,24 +1,16 @@
#!/usr/bin/env bash
DEST_LOCAL="/backup/borg_ythel"
DEST_REMOTE="centos@austell.randomroad.net:/data/backup/borg_ythel"
SOURCES="/home /etc /var /data/Music
HOST="ythel"
DEST_LOCAL="/backup/borg_${HOST}"
SOURCES="/home /etc /var /data"
if [ $(hostname -s) != "ythel" ]; then
echo "Must be run from ythel"
if [ $(hostname -s) != "${HOST}" ]; then
echo "Must be run from ${HOST}"
exit 255
fi
echo "Local Backup to ${DEST_LOCAL}"
sudo borg create -s --progress "dave@127.0.0.1:${DEST_LOCAL}::$(date '+%Y%m%d-%H%M')" ${SOURCES}
if [[ $1 == "local" ]]; then
echo "Local Backup"
sudo borg create -s --progress ${DEST_LOCAL}::$(date '+%Y%m%d-%H%M') ${SOURCES}
exit
fi
if [[ $1 == "remote" ]]; then
echo "Remote Backup"
sudo borg create -s --progress ${DEST_REMOTE}::$(date '+%Y%m%d-%H%M') ${SOURCES}
exit
fi
echo "Unknown backup dest - specify local or remote"
echo
echo DONE
echo