LXC Backup Script
-
#!/bin/bash echo echo "==============================" echo Stopping Containers..... echo "==============================" echo for i in $(ls /var/lib/lxc); do lxc-stop -n $i ; done echo Done! echo echo "==============================" echo Backing Up Containers..... echo "==============================" echo cd /var/lib/lxc/ for i in $(ls /var/lib/lxc); do tar --numeric-owner -czf /root/backups/lxc/$i.tgz $i ; done echo Done! echo echo "==============================" echo Starting Containers..... echo "==============================" echo for i in $(ls /var/lib/lxc); do lxc-start -n $i ; done echo Done! echo echo "==============================" echo Syncing Container Backups to B2..... echo "==============================" echo b2 sync --keepDays 30 --replaceNewer /root/backups/lxc b2://aaronstuder/backups/lxc echo Done! echo echo "=====Backup Complete!====="
-
Any feedback is welcome
-
I like it. Nice and easy!
What is B2? Backblaze?
-
@dafyre said in LXC Backup Script:
I like it. Nice and easy!
What is B2? Backblaze?
Yes Back Blaze B2.
-
I can add support for AWS if anyone wants it. I added B2 because it's cheaper
-
I should add, with --keepDays 30 tells B2 to keep 30 days worth of versions.