[App_rpt-users] copying files between asterisk boxes under program control

Andrew Errington a.errington at lancaster.ac.uk
Sun Apr 10 06:19:35 UTC 2011


On Sun, 10 Apr 2011 12:35:31 you wrote:
> > > Secondly
> > >
> > > If possible, is there a way to direct the output of this transfer to
> > > "stdin" so that it can go directly into another program?
> >
> > Yes, you use ssh for this (not scp).  Here's how:
> >
> > http://gnuru.org/article/1522/copying-with-scp-stdin
>
> Yes OK - but I want it to go the stdin of the program running on the remote
> box.
> This is the box that is fetching the data/file.
> That means scp needs to send its file data to STDOUT (which would then be
> piped into the next program)

No, you can't do that with scp, but you can do it with ssh, as described in 
the article.  Like this:

echo "some text" | ssh user at remote.host "cat > /remote/file"

In this case, echo is writing to stdout.  It is piped to ssh, which 
establishes a connection to remotehost.  The other end of the pipe becomes 
stdout on remotehost, which connects to stdin of cat which dumps *its* stdout 
to a file.

So, replace echo with your program on localhost which is producing data to 
stdout, and cat with your program on remotehost which is consuming data on 
stdin. 

Are you transferring a stream of data, or just a file?

It's been I while since I had to do this, but I seem to remember it is a 
little counterintuitive.

HTH,

A



More information about the App_rpt-users mailing list