Looking for the most elegant way to schedule rclone copy from within a docker container

What is the problem you are having with rclone?

I'm running the official rclone docker container with a Plex mount and everything is working perfectly. I can access the mount from the host and from within other containers, so no issues there.

Where I'm struggling is working out the best way to implement a selection of scheduled rclone move commands, that I was previously using cron to activate (before I moved rclone into a container)
I was hoping I could set something up from within the container, ie; set up a cron job within it, however when I try to access terminal from within the rclone container (via portainer) it immediately closes. I'm running 12 other containers and all of those allow access to terminal without issue, so I'm not sure why the rclone container doesn't.
That aside, there may an alternative or more elegant solution to this that I'm failing to see... highly likely :smiley:

This is my rclone docker command:

docker run --restart=always --name rclone -e UMASK_SET=002 -e PUID=1000 -e PGID=1000 -v /home/craftyclown/.config/Docker/Rclone/config:/config/rclone -v /mnt:/mnt:shared -v /etc/passwd:/etc/passwd:ro -v /etc/group:/etc/group:ro --device /dev/fuse --cap-add SYS_ADMIN --security-opt apparmor:unconfined rclone/rclone:latest mount "RichFlixCrypt:/Encrypted/" /mnt/Skull --allow-other --buffer-size 256M --dir-cache-time 72h --log-level INFO --log-file /config/rclone/Plex_Mount.log --poll-interval 15s --timeout 1h --umask 002 --cache-dir=/mnt/rclone_cache --vfs-cache-mode full --vfs-cache-max-size 100G --vfs-cache-max-age 24h --tpslimit 2

and this is the scheduled rclone move script I want to run every 15 minutes:

LOCKFILE="/var/lock/`basename $0`"

(
    flock -n 9 || {
	echo "$0 already running"
	exit 1
    }

/usr/bin/rclone moveto ~/rtorrent/download/3d/ "RichFlixCrypt:/Encrypted/3D" -v --min-age 1m --log-file=/home/craftyclown/logs/rclone-upload.log --tpslimit 2 
/usr/bin/rclone moveto ~/rtorrent/download/movies4k/ "RichFlixCrypt:/Encrypted/UHD Movies" -v --min-age 1m --log-file=/home/craftyclown/logs/rclone-upload.log --tpslimit 2 
/usr/bin/rclone moveto ~/rtorrent/download/tv4k/ "RichFlixCrypt:/Encrypted/UHD TV_Shows" -v --min-age 1m --log-file=/home/craftyclown/logs/rclone-upload.log --tpslimit 2 
/usr/bin/rclone moveto ~/rtorrent/download/anime/ "RichFlixCrypt:/Encrypted/Anime" -v --min-age 1m --log-file=/home/craftyclown/logs/rclone-upload.log --tpslimit 2 
/usr/bin/rclone moveto ~/rtorrent/download/audiobooks/ "RichFlixCrypt:/Encrypted/Audio books" -v --min-age 1m --log-file=/home/craftyclown/logs/rclone-upload.log --tpslimit 2 
/usr/bin/rclone moveto ~/rtorrent/download/Sonyasbooks/ "RichFlixCrypt:/Encrypted/Books/Calibre/New/Sonya" -v --min-age 1m --log-file=/home/craftyclown/logs/rclone-upload.log --tpslimit 2
/usr/bin/rclone moveto ~/rtorrent/download/Richsbooks/ "RichFlixCrypt:/Encrypted/Books/Calibre/New/Rich" -v --min-age 1m --log-file=/home/craftyclown/logs/rclone-upload.log --tpslimit 2
/usr/bin/rclone moveto ~/rtorrent/download/filmmaking/ "RichFlixCrypt:/Encrypted/Film Making" -v --min-age 1m --log-file=/home/craftyclown/home/craftyclown/logs/rclone-upload.log --tpslimit 2 
/usr/bin/rclone moveto ~/rtorrent/download/game/ "RichFlixCrypt:/Encrypted/Game" -v --min-age 1m --log-file=/home/craftyclown/logs/rclone-upload.log --tpslimit 2 
/usr/bin/rclone moveto ~/rtorrent/download/software/ "RichFlixCrypt:/Encrypted/Software" -v --min-age 1m --log-file=/home/craftyclown/logs/rclone-upload.log --tpslimit 2 
/usr/bin/rclone moveto ~/rtorrent/download/tutorials/ "RichFlixCrypt:/Encrypted/Tutorials" -v --min-age 1m --log-file=/home/craftyclown/logs/rclone-upload.log --tpslimit 2 
/usr/bin/rclone moveto ~/rtorrent/download/vr/ "RichFlixCrypt:/Encrypted/VR" -v --min-age 1m --log-file=/home/craftyclown/logs/rclone-upload.log --tpslimit 2 
/usr/bin/rclone moveto ~/rtorrent/download/Football/ "RichFlixCrypt:/Encrypted/Football" -v --min-age 1m --log-file=/home/craftyclown/logs/rclone-upload.log --tpslimit 2  
rclone rmdirs ~/rtorrent/download/3d/ --leave-root --min-age 1m --log-file=/home/craftyclown/logs/rclone-upload.log
rclone rmdirs ~/rtorrent/download/movies4k/ --leave-root --min-age 1m --log-file=/home/craftyclown/logs/rclone-upload.log
rclone rmdirs ~/rtorrent/download/tv4k/ --leave-root --min-age 1m --log-file=/home/craftyclown/logs/rclone-upload.log
rclone rmdirs ~/rtorrent/download/anime/ --leave-root --min-age 1m --log-file=/home/craftyclown/logs/rclone-upload.log
rclone rmdirs ~/rtorrent/download/audiobooks/ --leave-root --min-age 1m --log-file=/home/craftyclown/logs/rclone-upload.log
rclone rmdirs ~/rtorrent/download/books/ --leave-root --min-age 1m --log-file=/home/craftyclown/logs/rclone-upload.log
rclone rmdirs ~/rtorrent/download/comics/ --leave-root --min-age 1m --log-file=/home/craftyclown/logs/rclone-upload.log
rclone rmdirs ~/rtorrent/download/filmmaking/ --leave-root --min-age 1m --log-file=/home/craftyclown/logs/rclone-upload.log
rclone rmdirs ~/rtorrent/download/game/ --leave-root --min-age 1m --log-file=/home/craftyclown/logs/rclone-upload.log
rclone rmdirs ~/rtorrent/download/movies/ --leave-root --min-age 1m --log-file=/home/craftyclown/logs/rclone-upload.log
rclone rmdirs ~/rtorrent/download/music/ --leave-root --min-age 1m --log-file=/home/craftyclown/logs/rclone-upload.log
rclone rmdirs ~/rtorrent/download/software/ --leave-root --min-age 1m --log-file=/home/craftyclown/logs/rclone-upload.log
rclone rmdirs ~/rtorrent/download/tutorials/ --leave-root --min-age 1m --log-file=/home/craftyclown/logs/rclone-upload.log
rclone rmdirs ~/rtorrent/download/tv/ --leave-root --min-age 1m --log-file=/home/craftyclown/logs/rclone-upload.log
rclone rmdirs ~/rtorrent/download/vr/ --leave-root --min-age 1m --log-file=/home/craftyclown/logs/rclone-upload.log
rclone rmdirs ~/rtorrent/download/Football/ --leave-root --min-age 1m --log-file=/home/craftyclown/logs/rclone-upload.log

) 9>$LOCKFILE

What is your rclone version (output from rclone version)

rclone v1.53.1

  • os/arch: linux/amd64
  • go version: go1.15.2

Which OS you are using and how many bits (eg Windows 7, 64 bit)

Ubuntu 20.04.1 LTS (GNU/Linux 5.4.0-48-generic x86_64)

Which cloud storage system are you using? (eg Google Drive)

Google Drive

Worked out the problem. It appears there is no bash shell for the rclone container, so I just used sh instead and managed to get the cron job set up.

I have come across another issue however. It seems that any files that rclone creates such as logs or the .conf file are owned by root and have limited permissions. Is there a way of changing this?

It seems that things aren't set up quite as well as I thought.

The rclone docker container uses a slimmed down version of Alpine linux and despite having crontab installed, it doesn't seem to be started so the scripts aren't automatically triggered.

Does anyone know how to trigger the crontab service to start from within the container?

This is my current docker script for rclone:

docker run --restart=always --name rclone --rc-addr :5572 -e UMASK_SET=002 -e PUID=1000 -e PGID=1000 -v /home/craftyclown/.config/Docker/Rclone/config:/config/rclone -v /home/craftyclown/.config/Docker/Rclone/logs:/logs -v /home/craftyclown/.config/Docker/Rclone/cron:/etc/periodic/15min/:ro -v /etc/localtime:/etc/localtime:ro -v /home/craftyclown/rtorrent/download:/rtorrent/download -v /mnt:/mnt:shared -v /etc/passwd:/etc/passwd:ro -v /etc/group:/etc/group:ro --device /dev/fuse --cap-add SYS_ADMIN --security-opt apparmor:unconfined rclone/rclone:latest mount "RichFlixCrypt:/Encrypted/" /mnt/Skull --allow-other --buffer-size 256M --dir-cache-time 72h --log-level INFO --log-file /logs/Plex_Mount.log --poll-interval 15s --timeout 1h --umask 002 --cache-dir=/mnt/rclone_cache --vfs-cache-mode full --vfs-cache-max-size 100G --vfs-cache-max-age 24h --tpslimit 3

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.