Rclone copy didn't find section in config file

I’m making a script in Bash to make a dump in my postgres database and send it to Google Drive with rclone.
When i run the command in my Terminal: rclone mypath Remote:MyPast/
Everything works fine ! The backup is made and everything is perfectly okay.
The problem is when i try run this command inside my backup.sh script i get this erro in the log.file:

2019/01/30 08:34:53 NOTICE: Config file "/var/lib/postgresql/.config/rclone/rclone.conf" not found - using defaults
2019/01/30 08:34:53 Failed to create file system for "FapitecBackup:/backups/2019-01-30T08-34-46": didn't find section in config file

I thought of making the modifications in my rclone.conf, but I do not think that’s the problem, because it works well with the command alone.

The other problem is that i have to pass this script.sh to an server who i only have acess via ssh. How i will make the remote for this if the remote is created opening a webbroswer?
I have to made the remote in another machine and then pass the token, client_id and client_secret for rclone.conf?

You can use the config file option in your script to point to wherever your config file is located if not the default location:

--config string                              Config file. (default "/home/ncw/.rclone.conf")

You’d need to setup rclone.conf on the other machine and you can do that via the headless option:

https://rclone.org/remote_setup/

That’s it’s great, answered my second question. But i still have a problem with the first one.

You need to use the --config parameter in the rclone command you are running to point to your rclone config. That was the first part of my post answering your first question.

I only have one config file in my machine and is the default config file when i created the remote. I have used the auto config. I don’t have more than one remote.
I think i’m don’t still get it.

Edit: OOH i get it. Sorry i’m dumb. Works now. Thank you !

Run

felix@gemini:~$ rclone config file
Configuration file is stored at:
/data/rclone/rclone.conf

and pass that --config filelocationabove

to your script that’s running the rclone command. Not sure what your script has in it as you didn’t share it so it’s just a guess.

Worked with the --config flag pointing to the path of the rconfig file.
Just one last question. I have to use the sudo chown postgres path for give permission to it because i got a permission denied.
I made with this script: [https://pastebin.com/3sngeZtM]
The proxy, config path option i can put in the my rclone.config file or it’s better leave in the script?
There’s a flag in rclone for see if my drive is full?

You’d probably want to give the user the right permissions to get the backup done as changing permissions on those file locations might break something else.

The second question is really up to personal preference as there isn’t really a better way. I’d say keep with what works for you.

Yes, it is old issue! But not rclone issue.
It happend if you are using sudo or "sudo -s" to configure rclone as root. Your config file will be but in your user home folder and not in /root/.