Config and run rclone in script for on-demand uses

What is the problem you are having with rclone?

Configure and run rclone in a powershell script to download files from a S3 server, but cannot use interactive "rclone config" as my project needs to run silently/scripted. How do I accomplish this?

Run the command 'rclone version' and share the full output of the command.

rclone v1.62.2

  • os/version: Microsoft Windows 11 Home 22H2 (64 bit)
  • os/kernel: 10.0.22621.1702 Build 22621.1702.1702 (x86_64)
  • os/type: windows
  • os/arch: amd64
  • go/version: go1.20.2
  • go/linking: static
  • go/tags: cmount

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

Wasabi

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

rclone copy remote_wasabi_s3:deploy/agent/backup/veeamagent-installer.zip C:\Windows\TEMP\veeamsetup\
rclone copy remote_wasabi_s3:deploy/agent/backup/veeamagent-config-clientname.zip C:\Windows\TEMP\veeamsetup\

The rclone config contents with secrets removed.

There is no config file to share at the moment - I'm trying to have a silent/scripted on-demand setup

hello and welcome to the forum,

there are at least three ways:

  1. use connection strings, then no need for config file.
  2. use environment variables, then no need for config file.
  3. if you must use a config file, then use rclone config create
1 Like

Thank you! Thank you! Thank you! Connection strings is what I used and it's working perfectly. Since I couldn't find any code snippets out there and it took me awhile to get around the quirks, here's an snippet from the code that's working for me now (Powershell):

$ErrorActionPreference = "Stop"

$rcloneveeamagentArgumentList = @("copy", ":s3,provider=Wasabi,access_key_id=ACCESSKEYHERE,endpoint='https://s3.us-west-1.wasabisys.com',secret_access_key=SECREYKEYHERE:$remote_veeam_s3_path", "$local_working_folder")

$rcloneveeamRunResults = Start-Process $local_working_folder\rclone.exe -ArgumentList $rcloneveeamagentArgumentList -Wait -PassThru -NoNewWindow | Out-Null

if ($rcloneveeamRunResults.ExitCode -ne 1) {
  write-output "[$(Get-Date)] - Veeam Agent installer copied successfully from S3 storage." *>&1 | Tee-Object -FilePath $session_log_path -Append
} else {
  write-output "[$(Get-Date)] - Veeam Agent installer copy from S3 storage FAILED! Exiting script." *>&1 | Tee-Object -FilePath $session_log_path -Append
  exit -1
}

Hope that helps someone!

2 Likes

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