From 8685592976950e693f75a68438c248e858830d40 Mon Sep 17 00:00:00 2001 From: tanshu Date: Wed, 7 Mar 2018 12:06:17 +0000 Subject: [PATCH] (Grav GitSync) Automatic Commit from tanshu --- pages/06.bitwarden/docs.md | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/pages/06.bitwarden/docs.md b/pages/06.bitwarden/docs.md index 5bbbc44..2d93c23 100644 --- a/pages/06.bitwarden/docs.md +++ b/pages/06.bitwarden/docs.md @@ -55,6 +55,15 @@ Go to `https://github.com/prasmussen/gdrive` and download `gdrive-linux-x64` in wget -o ~/bin/gdrive $URL_FOR_GDRIVE_LINUX_X64_BINARY ``` Make it executable `chmod +x ~/bin/gdrive` + +#### Setup local directory for upload + +```sh +mkdir -p ~/Data/warden +cd ~/Data/warden +ln -s ~/webapps/warden/db/production.sqlite3 production.sqlite3 +``` + #### Configure Google Drive Link your gdrive to the account by running `gdrive list` and following the instructions. @@ -62,7 +71,16 @@ Create a folder called `Bitwarden` and get its id by running `gdrive list`. Create upload script named `bw.sh` in the home directory and make it executable `chmod +x ~/bw.sh` ```sh -~/bin/gdrive upload upload --parent $FOLDER_ID --name production_$(date +%F-%H:%M).sqlite3 ~/webapps/warden/db/production.sqlite3 +#!/usr/bin/env bash +cd ~/Data/warden +if sha512sum --status --check production.sha512sum; +then + echo "File already uploaded. No update needed" +else + echo "Files are different. Uploading" + ~/bin/gdrive upload --parent 1wZ7KOAZUreXN434ie0-edqgINxGcnlSo --name production_$(date +%F-%H:%M).sqlite3 ~/Data/warden/production.sqlite3 + sha512sum production.sqlite3 > production.sha512sum +fi ``` #### Automate Backups