|
|
|
Copy borg scripts to hosts, from IT Manual borg directory:
|
|
|
|
|
|
|
|
for i in `~/bin/forksand-get-vms |grep -v Pool | sort -u | grep -v template` ; do ssh $i mkdir -p borg ; scp -p forksand-borg-* $i:borg/ ; done
|
|
|
|
|
|
|
|
ssh into the hosts:
|
|
|
|
for i in `grep ^sf- .clusterssh/clusters | cut -f 1 -d " "` ; do clusterssh $i ;done
|
|
|
|
|
|
|
|
sudo su -
|
|
|
|
mv /home/jebba/borg /root/
|
|
|
|
chown -R root:root /root/borg
|
|
|
|
cd /root/borg
|
|
|
|
# Note, get real string with correct host/user/pass:
|
|
|
|
sed -i -e 's/user@host/1234@host.com/g' forksand-borg-*
|
|
|
|
# If repo is moved, run:
|
|
|
|
# sed -i -e 's/BORG_RELOCATED_REPO_ACCESS_IS_OK=no/BORG_RELOCATED_REPO_ACCESS_IS_OK=yes/g' forksand-borg-*
|
|
|
|
|
|
|
|
# No password:
|
|
|
|
ssh-keygen -t ed25519 -f /root/.ssh/id_ed25519-borg-`hostname`
|
|
|
|
|
|
|
|
# Create borg key (needs rsync.net password):
|
|
|
|
./forksand-borg-add-key
|
|
|
|
|
|
|
|
# Initalize new repo, no passphrase:
|
|
|
|
./forksand-borg-init
|
|
|
|
|
|
|
|
# Collect keys to backup:
|
|
|
|
./forksand-borg-tar-keys
|
|
|
|
mv /root/borg-`hostname`-keys.tar.bz2 /home/jebba/
|
|
|
|
|
|
|
|
# Remote host, pull key backups
|
|
|
|
scp -p [hostname]:borg-*-keys.tar.bz2 .
|
|
|
|
|
|
|
|
# On server, remove key backups:
|
|
|
|
rm -rf /home/jebba/borg-`hostname`-keys.tar.bz2 /root/borg-`hostname`-keys-done
|
|
|
|
|
|
|
|
# Set up backup cron.
|
|
|
|
sudo su -
|
|
|
|
crontab -e
|
|
|
|
# Add, changing the first number so they don't all run at the same time:
|
|
|
|
# m h dom mon dow command
|
|
|
|
0 * * * * /root/borg/forksand-borg-create
|
|
|
|
|
|
|
|
# Make a new backup:
|
|
|
|
./forksand-borg-create
|
|
|
|
|