Skip to content

Instantly share code, notes, and snippets.

@akash07k
Forked from athphane/bitwarden-backup.sh
Created June 13, 2022 15:00
Show Gist options
  • Save akash07k/55bfb80be6e61083ce02e3a495ce67cd to your computer and use it in GitHub Desktop.
Save akash07k/55bfb80be6e61083ce02e3a495ce67cd to your computer and use it in GitHub Desktop.
Bash script to zip up Vaultwarden data directory and upload to Cloud storage.
#!/bin/bash
#edit these to your config
BWDIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
DATETIME="$(date +'%Y-%m-%d_%H-%M-%S')"
FOLDERPATH="$(date +'%Y-%m-%d')"
GZFILE=bitwarden-${DATETIME}.tar.gz
#change working dir to /tmp
cd /tmp/
# Compress Vaultwarden directory to gzfile
tar -Pczf $GZFILE $BWDIR
# Copy the file to an Rclone storage endpoint
rclone copy $GZFILE MyGoogleDrive:/bitwarden_backups/${FOLDERPATH}/
#remove temp file
rm $GZFILE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment