#!/bin/bash
#----------------------------------------------------------------------------
# This script mounts your remote share with the recommended options.         |
# Just define the remote you wish to mount as well as the local mountpoint.  |
# The script will create a folder at the mountpoint                          |
#----------------------------------------------------------------------------
#mkdir -p /mnt/cache/gdrive
#mkdir -p /mnt/cache/tdrive
#mkdir -p /mnt/cache/gphotos
GDRIVE="/mnt/user/Google/gdrive"
TDRIVE="/mnt/user/Google/tdrive"

rclone mount gdrive: $GDRIVE \
--allow-other \
--size-only \
--uid=1000 --gid=1000 \
--umask 002 \
--log-file=/mnt/user/logs/rclone/rclone-gdrive.log \
--log-level ERROR \
--timeout 1h \
--dir-cache-time 2m \
--vfs-cache-max-age 72h \
--vfs-read-chunk-size 64M \
--vfs-read-chunk-size-limit 5G \
--drive-chunk-size 128M \
--buffer-size 64M \
--user-agent='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36' &

rclone mount tdrive: $TDRIVE \
--allow-other \
--size-only \
--uid=1000 \
--gid=1000 \
--umask 002 \
--log-file=/mnt/user/logs/rclone/rclone-tdrive.log \
--log-level ERROR \
--timeout 1h \
--dir-cache-time 2m \
--vfs-cache-max-age 72h \
--vfs-read-chunk-size 64M \
--vfs-read-chunk-size-limit 5G \
--drive-chunk-size 128M \
--buffer-size 64M \
--user-agent='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36' &

#rclone mount gphotos: /mnt/cache/gphotos \
#--allow-other \
#--size-only \
#--uid=1000 --gid=1000 \
#--umask 002 \
#--log-file=/mnt/user/logs/rclone/rclone-gdrive.log \
#--log-level ERROR \
#--timeout 1h \
#--dir-cache-time 2m \
#--vfs-cache-max-age 72h \
#--vfs-read-chunk-size 64M \
#--vfs-read-chunk-size-limit 5G \
#--drive-chunk-size 128M \
#--buffer-size 64M \
#--user-agent='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36' &


rclone rc --rc-addr=192.168.10.222:5573 \
--rc-user=cartache \
--rc-pass=Cartache1X \
mount/mount fs=tdrive: mountPoint=/mnt/user/Cloud/tdrive \
# This is for allowing users other than the user running rclone access to the mount
--allow-other \
# Google Drive is a polling remote so this value can be set very high and any changes are detected via polling.
--dir-cache-time 1000h \
# I reduce the poll interval down to 15 seconds as this makes changes appear fast the API quotas per day are huge
--poll-interval 15s \
# This is setting the file permission on the mount to user and group have the same access and other can read
--umask 002 \
# Please set this to your own value below
--user-agent sinedbret-ket \
# The local disk used for caching
--cache-dir=/mnt/cache/rclone \
# This is used for caching files to local disk for streaming
--vfs-cache-mode full \
# This limits the cache size to the value below
--vfs-cache-max-size 500G \
# This limits the age in the cache if the size is reached and it removes the oldest files first
--vfs-cache-max-age 336h \
# This sets a per file bandwidth control and I limit this to a little bigger than my largest bitrate I'd want to play
--bwlimit-file 25M
--fast-list \
# The log level output INFO/NOTICE 
--log-level INFO \
# Location of the log file
--log-file /mnt/user/logs/rclone/rclone-mount-tdrive.log


rclone rc --rc-addr=192.168.10.222:5573 \
--rc-user=cartache \
--rc-pass=Cartache1X \
mount/mount fs=gdrive: mountPoint=/mnt/user/Cloud/gdrive \
# This is for allowing users other than the user running rclone access to the mount
--allow-other \
# Google Drive is a polling remote so this value can be set very high and any changes are detected via polling.
--dir-cache-time 1000h \
# I reduce the poll interval down to 15 seconds as this makes changes appear fast the API quotas per day are huge
--poll-interval 15s \
# This is setting the file permission on the mount to user and group have the same access and other can read
--umask 002 \
# Please set this to your own value below
--user-agent sinedbret-ket \
# The local disk used for caching
--cache-dir=/mnt/cache/rclone \
# This is used for caching files to local disk for streaming
--vfs-cache-mode full \
# This limits the cache size to the value below
--vfs-cache-max-size 500G \
# This limits the age in the cache if the size is reached and it removes the oldest files first
--vfs-cache-max-age 336h \
# This sets a per file bandwidth control and I limit this to a little bigger than my largest bitrate I'd want to play
--bwlimit-file 25M
--fast-list \
# The log level output INFO/NOTICE 
--log-level INFO \
# Location of the log file
--log-file /mnt/user/logs/rclone/rclone-mount-gdrive.log