How to abort after a permission denied (or other) error?

What is the problem you are having with rclone?

I'm running rclone through ansible and, due to the way ansible works, I can only see the resulting stdout once the command finishes. But sometimes all the files being sync'd have wrong permissions and are therefore skipped due to a permission denied error. But I can only find out after the whole command is finished, which can take a long time.

I would like rclone to abort after the first error (permission denied or other).

I already browsed through all the existing flags and didn't find any that produces this behaviour. I also searched this forum and didn't find any mention to this.

Please tell me if this is possible today and how. If it's not, would it be possible to implement it?

Thanks in advance,
Nuno

What is your rclone version (output from rclone version)

rclone v1.45
  os/arch: linux/amd64
  go version: go1.11.6

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

Debian Buster 64bit

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

Backblaze B2 (irrelevante because this problem is related to the local source files)

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

rclone --verbose --transfers 32 --b2-hard-delete --bwlimit 0.625M sync /mnt/source b2_source_mirror:source-mirror

The rclone config contents with secrets removed.

[b2_source_mirror]
type = b2
account = xxx
key = yyy
hard_delete = true

hello and welcome to the forum,

that is an ancient version of rclone.
https://rclone.org/downloads/#script-download-and-install

1 Like

Wow. Thanks! I had no idea I was using such an old version. I installed it through Debian aptitude and I guess the repository is still using that old version. Ok, now I'm using v1.53.1.

Still, I wasn't able to find any way to make rclone abort after the first error:

2020/10/11 00:22:36 ERROR : restic: failed to open directory "restic": open /mnt/caixote/restic: permission denied
2020/10/11 00:22:36 ERROR : 1.txt: Failed to calculate src hash: hash: failed to open: open /mnt/caixote/1.txt: permission denied

I guess there must be a way to do it but I wasn't able to figure it out yet :frowning:

Please advise.

Thanks in advance,
Nuno

you can parse the log file in real-time.

tail -f rclone.log | grep 'ERROR :'

I'm not aware of any way to stop rclone on the first error.

You can get an exit code from the end and report on that.

Thanks @asdffdsa, actually parsing the log file in real-time is what I usually do when I'm running rclone locally. But in this case I want to run in remotely via Ansible in a scheduled job. So that will not be possible.

@Animosity022 thank you. I guess I have to settle with waiting for the whole thing to finish and check the error code in the end.

I will post an issue in github proposing this feature.

Thank you!
Nuno

Is that a normal thing to have a remote you don't permissions to?

You could just write one test file and check the exit code from that.

@Animosity022 I use restic to create versioned deduplicated backups. It creates one restic repository per backed up host. For some strange reason, restic sets some particular files to 400 (this is actually hard coded in restic's code and is already under discussion by restic's community).

So, I usually run a script to correct the permissions and change file ownership before I run rclone.

I hope this was clear.

I used to do all this manually. And sometimes I forgot to fix the permissions. But, now that I think about it, since I'm in the process of trying to use ansible to automate the whole process, I just have to add an extra step to fix the permissions. So... probably this will no longer be a real issue to me.

Still, I think it's something worth adding: aborting after N errors.

Thanks as that makes the reason clear!

1 Like

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