#!/bin/bash

# check if we are the only local instance
if [[ "`pidof -x $(basename $0) -o %PPID`" ]]; then
  echo "This script is already running with PID `pidof -x $(basename $0) -o %PPID`" >> "${LOGDIR}"
  exit
fi


#Wed-00:30,off Wed-06:00,12M Wed-08:00,6M Wed-18:00,512 \
#Thu-00:30,off Thu-06:00,12M Thu-08:00,6M Thu-18:00,512 \
#Fri-00:30,off Fri-06:00,12M Fri-08:00,6M Fri-18:00,512 \
#Sat-00:30,off Sat-06:00,12M Sat-08:00,6M Sat-18:00,512 \
#Sun-00:30,off Sun-06:00,12M Sun-08:00,6M Sun-18:00,512" \

rclone sync tdrive:/movies /mnt/user/Movies \
--bwlimit "Mon-00:30,off Mon-06:00,6M Mon-08:00,4M Mon-18:00,512 Tue-00:30,off Tue-06:00,6M Tue-08:00,4M Tue-18:00,512 Wed-00:30,off Wed-06:00,6M Wed-08:00,4M Wed-18:00,512 Thu-00:30,off Thu-06:00,6M Thu-08:00,4M Thu-18:00,512 Fri-00:30,off Fri-06:00,6M Fri-08:00,4M Fri-18:00,512 Sat-01:00,off Sat-08:00,6M Sat-10:00,4M Sat-18:00,512 Sun-01:00,off Sun-08:00,6M Sun-10:00,4M Sun-18:00,512" \
--tpslimit 8 \
--tpslimit-burst 5 \
--drive-chunk-size 256M \
--fast-list \
--drive-acknowledge-abuse \
--log-level "INFO" \
--log-file "/mnt/user/logs/rclone/rclone_sync_ggl_movies.log"
