#!/bin/bash

CurrentTime=$(date '+%H%M%S')

if [ $CurrentTime -ge 80000 ] && [ $CurrentTime -le 173000 ]
then
  BW="8M"
elif [ $CurrentTime -ge 173100 ] && [ $CurrentTime -le 233000 ]
then
  BW="2M"
elif [ $CurrentTime -ge 233100 ] && [ $CurrentTime -le 03000 ]
then
  BW="10M"
elif [ $CurrentTime -ge 03100 ] && [ $CurrentTime -le 75900 ]
then
  BW="15M"
fi

echo "$(date +%H:%M) - Bandwidth is $BW" >> /mnt/user/logs/bw.log
rclone rc --rc-addr=192.168.10.222:5573 core/bwlimit --rc-user=cartache --rc-pass=Cartache1X rate=$BW