Kill Rclone on Error

I’m trying to make my Rclone mount as user friendly as possible. Is it possible to kill Rclone in the event of an error? For example, whenever a refresh token is invalid or expires and I attempt to mount that remote, it returns an error (obviously) but the process does not terminate. Is this possible with a shell script?

Any direction/help is appreciated!

The token should be automatically refreshed - is that not what you see?

Which remote are you using?

If you know what errors you are looking for you could parse the log file. Or you could try listing the mount directory in the shell script and if that fails kill the mount.

I should have noted that I intentionally screwed up my token. I wanted to put myself in the position of a user who somehow invalidated their token and would experience that API error. We are trying to implement Rclone with the worst-case end users in mind.

I like the idea of listing the mount directory and killing it based on that.

One last thing, is it possible to pipe responses to the rclone config in order to “automate” that process? Again, we are trying to design our implementation in a more user friendly way so that users do not have to access it via the terminal.

You can user rclone config update to set options in the config file in a script. I’m not sure that is quite enough for a fully automated setup if it includes an oauth roundtrip.

I haven’t tried piping directly to rclone config it would probably work…

In an ideal world what would you like to see?

The powers that be would like the configuration to be as user friendly as possible. Apparently the CLI isn’t simple enough. Personally, I think a monkey could do it. I’m of the opinion that if you can’t follow this simple CLI then why are you even on our server (not to mention, we could document it heavy with pictures and all)…

Anyway, we are setting this up for box so - all the user has to type in is n, (name), box, enter, enter, yes, -> oauth, yes… Seems simple enough, but they want a GUI to do it. So I was trying to use a Zenity window to take in the remote name and then feed that and all the other set responses to rclone.

I think I could write a python script with my own client_id and client_secret to generate auth and refresh tokens, right? And then I could use python to write the rclone.conf file itself thus eliminating the need to do rclone config at all.

I would have thought that would work OK.

Yes you could do that too. It would be slightly more work but I would have thought it would work perfectly.