Problem running rclone backup with cron job script

What is the problem you are having with rclone?

I have problem running rclone backup with cron job script in /etc/cron.hourly folder. It seems it looks for the config file in /root/.config/. How to make it look for the configuration file in my home folder?

What is your rclone version (output from rclone version)

rclone v1.54.0

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

MX Linux 64 bit

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

The command you were trying to run (eg rclone copy /tmp remote:tmp)

Paste command here

The rclone config contents with secrets removed.

Paste config here

A log from the command with the -vv flag

2021/03/12 18:17:01 DEBUG : rclone: Version "v1.54.0" starting with parameters ["rclone" "sync" "/" "dropboxcrypt:" "--filter-from=/home/user/Scripts/Rclone/Filters/dropboxcrypt.txt" "--log-file=/home/user/Logs/rclone_dropboxcrypt.txt" "-vv"]
2021/03/12 18:17:01 DEBUG : Creating backend with remote "/"
2021/03/12 18:17:01 NOTICE: Config file "/root/.config/rclone/rclone.conf" not found - using defaults
2021/03/12 18:17:01 DEBUG : Creating backend with remote "dropboxcrypt:"
2021/03/12 18:17:01 Failed to create file system for "dropboxcrypt:": didn't find section in config file
2021/03/12 19:17:01 DEBUG : rclone: Version "v1.54.0" starting with parameters ["rclone" "sync" "/" "dropboxcrypt:" "--filter-from=/home/user/Scripts/Rclone/Filters/dropboxcrypt.txt" "--log-file=/home/user/Logs/rclone_dropboxcrypt.txt" "-vv"]
2021/03/12 19:17:01 DEBUG : Creating backend with remote "/"
2021/03/12 19:17:01 NOTICE: Config file "/root/.config/rclone/rclone.conf" not found - using defaults
2021/03/12 19:17:01 DEBUG : Creating backend with remote "dropboxcrypt:"
2021/03/12 19:17:01 Failed to create file system for "dropboxcrypt:": didn't find section in config file

hi
https://rclone.org/docs/#config-config-file

This works but it changes the ownership of the configuration file in my home directory to root and after that i get permission denied if i try to use rclone.

not a linux expert but these seems to be a file permissions error.
imho, never a good idea to run as root user whenever it can be avoided.

so i would setup the cronjob as a non-root user.
https://stackoverflow.com/questions/47668258/how-to-set-cronjob-with-non-root-user

I'm having this same issue. The reason were choosing to run as "root" is so the cron job is picked up by 'Anacron'. This utility runs cron jobs whenever the machine is on, not just at set times in a standard crontab. The catch-22 here is that anything linked from /etc/cron.{hourly,daily,weekly] will be run as root.

@u78

Here is my workaround:

/usr/bin/rclone copy --config "/home/User/.config/rclone/rclone.conf" --max-age 1h --no-traverse --fast-list /Data gdS:Backups/Home
chown User:User /home/User/.config/rclone/rclone.conf

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