Skip to content

Add upload to Google drive option #8

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions backup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,11 @@ mega_email=""
mega_pass=""
mega_path="/Root/backups" # /Root/ should always be here.

# Upload to Google Drive if you have installed and authorized the gdrive CLI.
gdrive_enable="no"
gdrive_dir_id="" # Used for uploading to a specific directory


# Full MySQL dump (All Databases)
mysql_backup="no"
mysql_user=""
Expand Down Expand Up @@ -436,6 +441,28 @@ then
fi
fi

# Upload archive file to Google Drive
if [ $gdrive_enable = "yes" ]
then
if [ `which gdrive` ]
then
echo -e "\n ${color}--- $date_now Uploading backup archive to Google Drive \n${nc}"
echo "$date_now Uploading backup archive to Google Drive" >> $log_file
if [ $gdrive_dir_id != "" ]
then
gdrive upload --parent $gdrive_dir_id $backup_path/$final_archive
else
gdrive upload $backup_path/$final_archive
fi
echo "$date_now Google Drive Upload Done." | tee -a $log_file
else
echo -e " ${color_fail}--- $date_now You have been enabled Google Drive upload. ${nc}"
echo -e " ${color_fail}--- $date_now You need to install gdrive. For more information see https://github.com/prasmussen/gdrive ${nc}"
echo -e " ${color_fail}--- $date_now Google Drive upload failed. ${nc}"
echo "$date_now Uploading to Google Drive failed. Install 'gdrive'. For more information see https://github.com/prasmussen/gdrive" >> $log_file
fi
fi

# Send a simple email notification
if [ $send_email = "yes" ]
then
Expand Down