Last active
March 7, 2024 03:32
-
-
Save h1dd3nsn1p3r/1a775d39f87407ebde5d35c5b726888a to your computer and use it in GitHub Desktop.
rClone script to backup files to google drive. You need to have rclone installed in your server (https://rclone.org/install/). After installing an rclone configure Google Drive (https://rclone.org/drive/). You can call this script from Linux crontab
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
############################################################################## | |
# An rclone bash script to backup files by Anuj Subedi ([email protected]). | |
# | |
# Copyright (C) 2020 Anuj Subedi <[email protected]> | |
# | |
# This script is licensed under the terms of the MIT license. | |
# https://opensource.org/licenses/MIT | |
# | |
# Runs the 'rclone sync' command. Designed to be used as a cron job. | |
# | |
# 1) Backup Source | |
# In our case backup source is dir /home/backup/ | |
# | |
# 2) Backup Destination | |
# This particulat script sync datas to Google Drive | |
# | |
# 3) Logs: | |
# Logs can be found in this dir /home/sysadmin/backup/logs/ | |
# | |
############################################################################## | |
# rclone source to sync | |
SRC_DIR='/home/backup' | |
# rclone remote storage | |
REMOTE_PATH='GoogleDrive:Server/Backup' | |
# rclone sync log path | |
RCLONE_LOG='/home/sysadmin/backup/logs/rclone-sync-gdrive-daily.log' | |
################################################### | |
## | |
## Let's run the sync command here | |
## | |
################################################### | |
/usr/bin/rclone sync $SRC_DIR $REMOTE_PATH --log-file=$RCLONE_LOG --log-level INFO --transfers=3 | |
# Once job is done, Exit the script | |
exit | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment