Hi all.
I have what I'm hoping is a very simple question for someone who's done similar.
I'd like to run a single rclone command upon completion of a successful cloud sync task. The command is simply to perform a clean-up operation on a BackBlazeB2 bucket but am struggling to get work out how the post-script options are supposed to function.
So far I've tried putting in the desire command directly, then realised the option is likely to want a prewritten script rather than a command line so I create a simple one-liner and tried to have the option run that and it fails no matter what.
The command itself is simply rclone cleanup <cloud sync bucket>:<cloud sync folder>
I've also tried using the CLOUD_SYNC_BUCKET CLOUD_SYNC_FOLDER parameters of the cloud sync task in case that might help.
The output from a cloud sync task, dry run shows
I have create the script outside of the task though via configuring an rclone target and running the previously generate script (with hardcoded bucket:path in that copy) and it operates fine so, and so I really have three questions for anyone who can help which are;
Thanks in advance to anyone who can assist.
I have what I'm hoping is a very simple question for someone who's done similar.
I'd like to run a single rclone command upon completion of a successful cloud sync task. The command is simply to perform a clean-up operation on a BackBlazeB2 bucket but am struggling to get work out how the post-script options are supposed to function.
So far I've tried putting in the desire command directly, then realised the option is likely to want a prewritten script rather than a command line so I create a simple one-liner and tried to have the option run that and it fails no matter what.
The command itself is simply rclone cleanup <cloud sync bucket>:<cloud sync folder>
I've also tried using the CLOUD_SYNC_BUCKET CLOUD_SYNC_FOLDER parameters of the cloud sync task in case that might help.
The output from a cloud sync task, dry run shows
Code:
Error: Traceback (most recent call last): File "/usr/local/lib/python3.9/site-packages/middlewared/job.py", line 355, in run await self.future File "/usr/local/lib/python3.9/site-packages/middlewared/job.py", line 391, in __run_body rv = await self.method(*([self] + args)) File "/usr/local/lib/python3.9/site-packages/middlewared/schema.py", line 975, in nf return await f(*args, **kwargs) File "/usr/local/lib/python3.9/site-packages/middlewared/plugins/cloud_sync.py", line 1098, in sync await self._sync(cloud_sync, options, job) File "/usr/local/lib/python3.9/site-packages/middlewared/plugins/cloud_sync.py", line 1145, in _sync await rclone(self.middleware, job, cloud_sync, options["dry_run"]) File "/usr/local/lib/python3.9/site-packages/middlewared/plugins/cloud_sync.py", line 244, in rclone await run_script(job, env, cloud_sync["post_script"], "Post-script") File "/usr/local/lib/python3.9/site-packages/middlewared/plugins/cloud_sync.py", line 290, in run_script raise CallError(f"{script_name} failed with exit code {proc.returncode}") middlewared.service_exception.CallError: [EFAULT] Post-script failed with exit code 1
I have create the script outside of the task though via configuring an rclone target and running the previously generate script (with hardcoded bucket:path in that copy) and it operates fine so, and so I really have three questions for anyone who can help which are;
- What's the syntax within the task setup screen used to a add a pre\post-script?
(can I just run a command directly or does it have to be a path to a script,
and if the latter does a need to be called\executed from SH similar)? - Has anyone gotten the CLOUD_SYNC_BUCKET CLOUD_SYNC_FOLDER parameters to work?
(so as to be able to reuse the script elsewhere and not have hardcoded versions for different tasks)
Thanks in advance to anyone who can assist.