#!/bin/bash

RCLONE_SOURCE="tdrive:/movies"
RCLONE_DESTINATION="/srv/mergerfs/unionfs/Movies"
RCLONE_ADDRESS="vmx-nas.swallow-grue.ts.net:44444"
RCLONE_USER="rclone"
RCLONE_PASSWORD="rclone"
RCLONE_SCRIPT_FILE=$(basename "$0") 
RCLONE_LOG_FILE="${RCLONE_SCRIPT_FILE%.*}.log"
[[ ! -f "$RCLONE_LOG_FILE" ]] && touch "$RCLONE_LOG_FILE"

rclone rc sync/copy _async=true srcFs=$RCLONE_SOURCE dstFs=$RCLONE_DESTINATION \
--exclude "*check" \
--exclude ".zzz*" \
--exclude "*chk" \
--rc-addr=$RCLONE_ADDRESS \
--rc-user=$RCLONE_USER \
--rc-pass=$RCLONE_PASSWORD \
--drive-stop-on-upload-limit \
--fast-list \
--log-file "$RCLONE_LOG_FILE" &
