-
-
Save Wizek/1a34c58d83fa49c68bb3320ad1991f55 to your computer and use it in GitHub Desktop.
Backup script for backblaze b2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# | |
# Backup selected directories to a Backblaze B2 bucket | |
# | |
# Example daily cron: | |
# @daily /usr/local/bin/b2backup >/dev/null | |
# | |
# Account creds | |
id=xxxxxxxxxx | |
key=xxxxxxxxxxxxxxxx | |
# Threads | |
threads=5 | |
# Directories to backup, and the name of their subdirectory in the bucket | |
declare -A dir | |
dir=(["/var/backups"]="backups" ["/var/www"]="www") | |
# Bucket name | |
bucket=linode | |
for i in "${!dir[@]}" do; | |
/usr/local/bin/b2sync -rxt$threads $id $key "$i" $bucket:"${dir["$i"]}" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment