I have a cron job setup to run every morning to backup to backblaze b2, but I get an error:
2018/03/31 05:30:02 Failed to create file system for "backblaze:bucket": didn't find section in config file
The command on my cron job is
/usr/sbin/rclone sync /home/backup backblaze:bucket.
I can then run the exact same command manually and it will work just fine. I have had this working before with Google Cloud but I have changed over to B2 and now I get this error every morning.
few things, is the cron running as the same user as you’re running it outside cron? can you try explicitly providing a path for the config with
--config /path/to/config flag in the cronjob?
I am not 100% positive but I image that cron is being ran under another user.
I did try using the --config but it returned
Failed to load config file "/root/.rclone.conf" - using defaults: open /root/.rclone.conf: permission denied.
A normal user doesn’t have rights to the /root directory. copy the config elsewhere and point rclone to that version
That reasonable - however - why would rclone use this directory by default and once I move the file location is there a way I can force rclone to use that directory rather than the one in the root directory?
As well, why would this present as an issue why no changes has been made on the server with the exception of changing the config.
Yes, the --config flag above.
I understand using the config file, my question is if I use
rclone config it will reference the file in the moved location, without using the --config flag.
rclone config --config=/path/to/rclone.conf
rclone by default will put the config directory in the home directory of the user that created it. So whenever you did your rclone config you did it was root so it was put in root’s home directory. You ran cron as another user so it was by default looking for it in that user’s home directory and it wasn’t there nor do regular users have access to /root.
If you do rclone config as the same user that is running the crontab you won’t see this behavior.
@Krandor That made perfect sense. I just reran the config under the user that my cron uses and I did see my old google cloud setup but not backblaze. I added backblaze under that user and it seems to work now. Thank you for your assistance.