#!/bin/bash

#Tentative de rédurie la taille du cache = 2TB
#vfsOpt='{"CacheMode": 3, "DirCacheTime": 3600000000000000, "PollInterval": 15000000000, "CacheMaxAge": 1209600000000000 }'

mountpoints="gdrive tdrive onedrive"

for mountpoint in $mountpoints
do
	umount "/mnt/cache/Cloud/$mountpoint"
	fusermount -uz "/mnt/cache/Cloud/$mountpoint"
	rclone rc --rc-addr=192.168.10.19:5572 \
	--rc-user=cartache \
	--rc-pass=Cartache1X \
	--log-file=/mnt/disks/lonely_1/logs/rclone/rclone-mount-$mountpoint.log \
	mount/mount fs=$mountpoint: mountPoint=/mnt/cache/Cloud/$mountpoint \
	mountOpt='{	"AllowOther": true, 
				"AsyncRead": true 
			}' \
	vfsOpt='{	"CacheMode": 3, 
				"DirCacheTime": 3600000000000000, 
				"PollInterval": 15000000000, 
				"CacheMaxAge": 1209600000000000, 
				"CacheMaxSize": 100000000000000
			}'
done


#	change by dbi on 20201112 for reducing cache disk space usage
# FROM vfsOpt='{"CacheMode": 3, "DirCacheTime": 3600000000000000, "PollInterval": 15000000000, "CacheMaxAge": 1099636000000000 }'
# TO 	vfsOpt='{"CacheMode": 3,"DirCacheTime": 3600000000000000}'

#vfsOpt='{
#		"CacheMode": 3, 
#		"DirCacheTime": 3600000000000000, 
#		"PollInterval": 15000000000, 
#		"CacheMaxAge": 1209600000000000,
#		"CacheMaxSize": 500000000000000
#		}'