Skip to content

Instantly share code, notes, and snippets.

@FoxxMD
Last active January 22, 2021 23:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save FoxxMD/3ffdfeb6ced97bc7957620c780cc94d3 to your computer and use it in GitHub Desktop.
Save FoxxMD/3ffdfeb6ced97bc7957620c780cc94d3 to your computer and use it in GitHub Desktop.
rclone setup

Install rclone plugin

Unraid => Apps => search for rclone and install the one with Waseh's Repository in it

Setup UI

create password file output => https://hostingcanada.org/htpasswd-generator/

From unraid terminal: echo "htpasswdOutput" > /boot/config/plugins/rclone/.htpasswd

Unraid => Settings => User Scripts => Add New Script name it rclone_gui

Click cog icon next to rclone_gui => Edit Script

Copy the contents of rclone_gui.sh to the text box.

Change Schedule Disabled to At First Array Start Only Click Apply at bottom of User Scripts page. This will make it start automatically after every reboot.

To manually start it now click Run In Background. Now the UI is started on http://unraidIP:7559

Setup remote configs

Open the UI http://unraidIP:7559 and login

Under Configs create two configurations:

  1. Provider type is local
  2. Provider type is Google Drive (detailed directions at https://rclone.org/drive/#making-your-own-client-id)

Setup Log Folder

In Krusader create a new folder at /media/appdata/rclone-logs

Setup gdrive sync (GDrive => Unraid backups share)

Unraid => Settings => User Scripts => Add New Script name it rclone_gdrive_backup

Click cog icon next to rclone_gdrive_backup => Edit Script

Copy the contents of rclone_gdrive_sync.sh to the text box and save

  • Make sure you replace gdriveConfigName with the name of the drive config you made earlier
  • Modify the backup location (/mnt/user/backups/gdrive) if you want it to backup somewhere else

Choose the schedule you want to run the script on, hourly is a good start.

Setup nextbutt sync (Local Nextbutt share => Unraid backups share)

Unraid => Settings => User Scripts => Add New Script name it rclone_nextbutt_backup

Click cog icon next to rclone_nextbutt_backup => Edit Script

Copy the contents of rclone_nextbutt_sync.sh to the text box and save.

  • Double check and modify the source and destination folders

Choose the schedule you want to run the script on, hourly is a good start.


scripts adapted from https://www.reeltalk.club/2020/06/13/backups-setting-up-encrypted-rclone-gsuite-in-unraid/

#!/bin/bash
CURRENT_DATE=$(date +%Y%m%d)
# The below file will be created or appended to for each
# for a given date. Ensure this destination folder exists
# and is writable
LOG_FILE=/mnt/user/appdata/rclone-logs/rclone-gdrive-sync-$CURRENT_DATE.log
echo "Logging to $LOG_FILE"
# Max transfer for each rclone command called
# IMPORTANT: GSuite has a 750GB/day upload limit
# If you run multiple rclone commands below, make sure
# You take that into account
# For example: 5 sync run daily should each get 750GB/5 == ~150GB
# Set to 750GB because this template is only calling rclone once
MAX_TRANSFER=750G
#######
# sync the GDRive to a backup folder
# IE Will make the contents of /mnt/user/backups/gdrive MIRROR your google drive
# For daily use
# "/mnt/user/backups/gdrive"
# Read documentation on what these (suggested) flags do
# https://rclone.org/flags/
#######
rclone sync -v \
--backup-dir=local:/mnt/user/backups/gdrive/old/backups-$CURRENT_DATE \
--bwlimit=30M \
--fast-list \
--tpslimit=3 \
--log-file=$LOG_FILE \
--checkers=4 \
--transfers=2 \
--max-transfer=$MAX_TRANSFER \
# add this next line in for testing purposes
# --dry-run \
gdriveConfigName:/ /mnt/user/backups/gdrive/current
# Give us the ability to see the error in our ways
chmod a+r $LOG_FILE
echo "Log file can be found at $LOG_FILE"
#!/bin/bash
cd /mnt/user
rclone rcd --rc-addr :7559 --rc-web-gui --rc-htpasswd /boot/config/plugins/rclone/.htpasswd
#!/bin/bash
CURRENT_DATE=$(date +%Y%m%d)
# The below file will be created or appended to for each
# for a given date. Ensure this destination folder exists
# and is writable
LOG_FILE=/mnt/user/appdata/rclone-logs/rclone-nextbutt-sync-$CURRENT_DATE.log
echo "Logging to $LOG_FILE"
#######
# sync the Local folder (nextbutt) to a backup folder
# IE Will make the contents of /mnt/user/backups/nextbutt MIRROR /mnt/user/nextbutt
# For daily use
# "/mnt/user/backups/nextbutt"
# Read documentation on what these (suggested) flags do
# https://rclone.org/flags/
#######
rclone sync -v \
--backup-dir=local:/mnt/user/backups/nextbutt/old/backups-$CURRENT_DATE \
--fast-list \
--log-file=$LOG_FILE \
# add this next line in for testing purposes
# --dry-run \
local:/mnt/user/nextbutt local:/mnt/user/backups/nextbutt/current
# Give us the ability to see the error in our ways
chmod a+r $LOG_FILE
echo "Log file can be found at $LOG_FILE"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment