Download backup with `curl` or `wget`

I occasionally have need to download a backup from an instance where I can’t ssh. Pulling 2GB down over my home internet connection where speedtest.net claims I get almost 500Mbps down isn’t that painful, but pushing it back up a 20Mbps is.

I thought that I might be able to use curl and pass an API key to download the backup, but what it gets is a redirect in an HTML document, and trying that URL in curl ends in a “bad request.”

Is there some way to do this that I’m missing?

Yeah, sounds familiar. I made this a few years ago. Haven’t used it in a while though so I’m not sure if it still works without modifications.

4 Likes

Wow! My dreams (maybe) answered! Thanks, Michael. I guess I should have searched a bit harder.

2 Likes

Why not just SCP server to server?

It uses SSH, will allow transfers that don’t hit your local line, and is already present on every host.

1 Like

There exist Discourse instances on the planet where I have admin access, but not SSH/SCP access. :wink:

4 Likes

I just had this problem too trying to pull a backup from a machine that was not my machine (so no SSH access). It was further complicated as I use Brevo as the email provider and they mangle the link to redirect to their own server for tracking.

For the backup emails, it might be useful to explicitly show the full URL and token instead of hiding it in the a href which can be overritten by email providers.

You will still need to login otherwise the link won’t work either.

Is there a simple way to ‘login’ via the commandline of a remote machine before issuing the wget to download the backup?

Did you try my script in the second post?

1 Like