Last active
March 29, 2020 09:18
-
-
Save hxueh/b72ccdd832be538eafa684c65e0de87e to your computer and use it in GitHub Desktop.
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 sh | |
LEDGER_DIR="/path/to/directory" | |
LEDGER_NAME="Ledger" | |
GPG_PUB_KEY="YOURGPGFINGERPRINT" | |
NOW=$($(which date) --iso-8601=seconds) | |
CURRENT_MONTH=$($(which date) +%Y-%m) | |
BACKBLAZE_BUCKET="YOURBUCKETNAME" | |
BACKBLAZE_REMOTE_FILE_DIR="Ledger" | |
$(which tar) --exclude=".vscode" --exclude=".git" --create --directory $LEDGER_DIR $LEDGER_NAME | $(which gzip) --best | $(which gpg) --encrypt --recipient $GPG_PUB_KEY --output /tmp/$LEDGER_NAME.$NOW.tgz.gpg | |
$(which b2) upload-file $BACKBLAZE_BUCKET /tmp/$LEDGER_NAME.$NOW.tgz.gpg $BACKBLAZE_REMOTE_FILE_DIR/$CURRENT_MONTH/$LEDGER_NAME.$NOW.tgz.gpg |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment