-
-
Save AlexanderProd/cb645cf858fd5c89780e7df267226b80 to your computer and use it in GitHub Desktop.
Backup script for backblaze working with backlaze b2 command line tool
This file contains 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 | |
# | |
# If youre encountering errors running the script you probably need Bash 4.0 | |
# | |
# You need to login to your b2 account once with b2 authorize-account [<accountId>] [<applicationKey>] before running it. | |
# | |
# Example daily cron running script.sh in home directory: | |
# @daily /usr/local/bin/bash ~/script.sh | |
# | |
# Threads | |
threads=10 | |
# Directories to backup, and the name of their subdirectory in the bucket | |
declare -A dir | |
dir=(["/Users/alexanderhoerl/Documents/test"]="test" ["/Users/alexanderhoerl/Documents/orders_export"]="test/orders_export/") | |
# Bucket name | |
bucket=test | |
for i in "${!dir[@]}"; do | |
b2 sync --threads "$threads" "$i" b2://$bucket/"${dir["$i"]}" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment