Last active
March 30, 2024 15:03
-
-
Save scottlinux/a341ae9128ef18fad6defa45b86ccd7c to your computer and use it in GitHub Desktop.
Google Cloud Nearline Backup Script
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 GoogleCloud Nearline bucket | |
# | |
# Example daily cron: | |
# @daily /usr/local/bin/gcbackup >/dev/null | |
# | |
# Directories to backup to the cloud | |
dir=( "/home/stmiller/Documents" "/home/stmiller/Music" \ | |
"/home/stmiller/ownCloud" "/home/stmiller/Pictures" \ | |
"/home/stmiller/Videos" ) | |
# Bucket name | |
bucket=sweet_gcbucket | |
# Backup specified directories! | |
for i in "${dir[@]}" do; | |
/usr/local/bin/gsutil -m rsync -r -d $i gs://$bucket/$(hostname)$i | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment