Re: Transfert file with scp (ssh)



On 2007-11-09, Claudio wrote:
On 2007-11-08, Rahan <Rahan@xxxxxxxxx> wrote:

Every day, i need to transfert 1 file from one to another solaris server
by using scp (ssh).

i am looking a script or an exemple of the script to do it by first
checking the presence of the file, and then, transfert it and
re-transfert it if the transfert fails for some raison like a network
problem or remote host down.

<untested>
scp file remote-machine:path/
while [ $0 -ne 0 ]; do
sleep 60
scp file remote-machine:path/
done
</untested>

I think it's understandable. $0 is the return value of the
last command. By convention, it equals 0 if everything was ok.

I think you mean $? not $0.

--
Chris F.A. Johnson, author <http://cfaj.freeshell.org/shell/>
Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)
===== My code in this post, if any, assumes the POSIX locale
===== and is released under the GNU General Public Licence
.



Relevant Pages

  • Re: Transfert file with scp (ssh)
    ... i need to transfert 1 file from one to another solaris server ... by using scp. ... i am looking a script or an exemple of the script to do it by first ...
    (comp.unix.shell)
  • Re: Transfert file with scp (ssh)
    ... i need to transfert 1 file from one to another solaris server ... by using scp. ... i am looking a script or an exemple of the script to do it by first ...
    (comp.unix.shell)
  • Re: Transfert file with scp (ssh)
    ... i need to transfert 1 file from one to another solaris server ... i am looking a script or an exemple of the script to do it by first ... scp filename otherhost:. ...
    (comp.unix.shell)
  • Re: Transfert file via SSH by a script
    ... i need to transfert 1 file from one to another solaris server by using scp. ... i am looking a script or an exemple of the script to do it by first checking the presence of the file, and then, transfert it and re-transfert it if the transfert fails for some raison like a network problem or remote host down. ...
    (comp.unix.solaris)
  • Re: yet another question on file names with spaces?
    ... > What's echo for? ... know what they are before the script runs - see below. ... present locally, but not remotely, I copy to the remote machine via scp. ... images and pdfs which I only want to transfer once. ...
    (comp.unix.shell)