linux mint IT admin tips info

RAFAEL GOULART’s Handy Gdrive Backup Script

With 15GB of space available on a Gdrive account now, it is a useful space to use. This easy to understand script will upload a folder's total file contents for you - handy for a GUI-less PC...with more research for gdrive dirs and auth etc.

sudo apt install grive

I followed the above page grive install instructions and script creation and it works fine. Just remember to create the "backups" directory on your Gdrive account.

Amend the directories to suit what you want to upload to Gdrive, and encrypt before hand it if sensitive - at your own Google/NSA hacking risk of course!

I tested it with the default /var/backup setting and it sent it all up:

Screenshot from 2014-04-21 01:27:33.png

At least I finally got something practical out of all the fruitless Blog uploader research I've been doing to find a solution to the Libre/openoffice doc Blog publishing nightmare...what?! No other apps than MSWord can format a word processor document with images tidily, AND publish it to a Blog?? Am I dreaming...? Open Source Programmers! There is a big niche market there! Where are you all??

Here's my version:
# Google Drive Sync
# Author: Rafael Goulart
# Config BEGIN
# =====================================================================

# Directory to backup

# Google Drive directory

# Directory target in remote

# =====================================================================
# Config END

# Create backup dir if not exists
echo Creating ${GDRIVEDIR}/${TARGETDIR} if needed
if [ ! -d "${GDRIVEDIR}/${TARGETDIR}" ]; then mkdir ${GDRIVEDIR}/${TARGETDIR}; fi

# Moving to Gdrive Dir
echo Entering ${GDRIVEDIR}

# Initial sync
echo Initial Google Drive Sync

# Coping new content
echo Copying from ${BACKUPDIR}/* to ${GDRIVEDIR}/${TARGETDIR}/

# Showing files copied
echo Files to sync

# Final sync
echo Final Google Drive Sync

It would be nice to have a progress bar of the upload, so I'll try piping it through pv and see if that works...

pv - monitor the progress of data through a pipe.
To use it, insert it in a pipeline between two processes, with the
appropriate options. Its standard input will be passed through to
its standard output and progress will be shown on standard error.

./ | pv

Not quite a progress bar, but gives a summary of time and upload speed:
Screenshot from 2014-04-21 02:07:19.png

Comments are closed.

Post Navigation