Instantly share code, notes, and snippets.

@kwa29 /backup-script
Last active Nov 19, 2018

Embed
What would you like to do?
#!/bin/bash
DATE=`date +%m-%d-%Y`
for dir in /home/*
do
base=$(basename "$dir")
tar -czf "/tmp/${base}-${HOSTNAME}-${DATE}.tar.gz" -C "$dir" .
drive upload -p '<GOOGLE_DRIVE_FOLDER_ID>' -f /tmp/${base}-${HOSTNAME}-${DATE}.tar.gz
rm -rf /tmp/${base}-${DATE}.tar.gz
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment