2

I need to acquire data from a little computer (Red Pitaya-linux) and save it to an external PC because it is very large. Also, I do not want to save the file first and then copy it using ssh for the same reason. Should I insert a ssh into the acquire script?

Jeff Schaller
  • 67,283
  • 35
  • 116
  • 255
  • 1
    I guess you would like to mount the drive from the external PC in a directory in the Red Pitaya-linux. Configure NFS sharing. The Red Pitaya-linux will use the shared directory as if it was a local directory. – Bruno Negrão Zica Jul 05 '16 at 04:16

2 Answers2

1

If I understand what you're asking, SFTP (https://www.freebsd.org/cgi/man.cgi?query=sftp&sektion=1) sounds like it would be your best bet to send a file from one server to another. The SCP command might also work, depending on how large the data is. You can use WinSCP, Filezilla, or just run it from the command line (usr/bin/sftp for most installs, but be sure to include IP/hostname:port).

SomeGuy
  • 242
  • Neither sftp nor scp will solve the problem that the questioner does "not want to save the file first." Probably you misread the problem. – Dubu Jul 05 '16 at 07:44
  • Exactly, what kind of command would save the .dat into an external disk – Joan Mendoza Jul 12 '16 at 17:18
  • You can either use the sftp prompt/shell or you can create a batch file using the -b flag to run a single command or for scripting.

    example: /usr/bin/sftp -b ${file} -oPort=${sftp_port} ${sftp_ip}

    – SomeGuy Jul 12 '16 at 18:50
1

Should I insert a ssh into the acquire script?

Probably yes.

If whatever you run on your little computer to collect data prints to stdout (or can be made to do so), you can just run it with ssh and redirect stdout on the local machine to a file.

e.g.

ssh user@redpitaya 'data-gathering-script-or-command' > localfile

If the output is huge, and/or you connect to it via an expensive network connection, you can save time (and maybe money) by compressing stdout on the little machine.

e.g.

ssh user@redpitaya 'data-gathering-script-or-command | gzip' > localfile.gz

or

ssh user@redpitaya 'data-gathering-script-or-command | gzip' | 
  gzip -d > localfile

Alternatively, you can use xz or lzma or any other compression tool instead of gzip.

NOTE: You're using CPU time on the little machine to minimise network traffic. Be careful not to overload the little box if it has a tiny, under-powered CPU.

cas
  • 78,579