Automate SSH to Retrieve Data from Volume

I currently use the following flow to extract data collected on a data volume attached to my fly app:

Open Windows Powershell and navigate to directory
fly ssh sftp shell
get file.sqlite local_path.sqlite
exit

I want to automate this in R. I have tried using the ssh package. But when I run ssh_connect(fly@app_name) I get:
Error: libssh failure at ‘connect’: Socket error: disconnected

How can I automate this? Thanks!

I don’t use R, but I assume an SFTP package would be closer to what you want. Is this any good?

I am not wedded to R - a solution in python or any other language works as well.

How about fly sftp get --quiet /data/file.sqlite local_path.sqlite?

That’s the same underlying mechanism packaged into a single command, without an intermediate subshell…

(Use the real full path in place of /data/, of course.)

1 Like

Works perfectly. Thank you!

1 Like

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