Skip to content

Instantly share code, notes, and snippets.

@intrd
Last active March 3, 2017 06:05
Show Gist options
  • Save intrd/cac69cac2b1adff69cf3379026791d1e to your computer and use it in GitHub Desktop.
Save intrd/cac69cac2b1adff69cf3379026791d1e to your computer and use it in GitHub Desktop.
Google Drive - Auto-sync(push/pull) script for odeke-em/drive
#!/bin/bash
## Google Drive - Auto-sync(push/pull) script for odeke-em/drive
# @author intrd - http://dann.com.br/
# @license Creative Commons Attribution-ShareAlike 4.0 International License - http://creativecommons.org/licenses/by-sa/4.0/
# gdrive4linux - https://github.com/odeke-em/drive
# crontab line: */1 * * * * /home/intrd/cloud/sync.sh >> /home/intrd/cloud/log.txt 2>&1
# Uncomment "while" to test w/out cron
#while true
#do
cd /home/intrd/cloud/
if inotifywait -t2 -e modify -e move -e create -e delete -r /home/intrd/cloud/; then
/home/intrd/.gvm/pkgsets/go1.5.2/global/bin/drive push -fix-clashes -quiet
/home/intrd/.gvm/pkgsets/go1.5.2/global/bin/drive pull -fix-clashes -quiet
echo "PUSHED"
fi
/home/intrd/.gvm/pkgsets/go1.5.2/global/bin/drive pull -fix-clashes -quiet
/home/intrd/.gvm/pkgsets/go1.5.2/global/bin/drive push -fix-clashes -quiet
echo "PULLED"
#done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment