(Grav GitSync) Automatic Commit from tanshu

This commit is contained in:
tanshu 2018-03-07 12:06:17 +00:00 committed by GitSync
parent 43bc5bff3f
commit 8685592976

View File

@ -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