PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Forums Hébergement > Forum Serveur - Sécurité et techniques > comp.unix.shell > Transfert file with scp (ssh)
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
comp.unix.shell Using and programming the Unix shell.

Transfert file with scp (ssh)

Réponse
 
LinkBack Outils de la discussion
Vieux 08/11/2007, 21h42   #1
Rahan
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Transfert file with scp (ssh)

Hello everybody,

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.

Sorry, i am beginner, could you me please.

Thanks a lot for your

Best Regards
Rahan
  Réponse avec citation
Vieux 08/11/2007, 22h11   #2
Icarus Sparry
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Transfert file with scp (ssh)

On Thu, 08 Nov 2007 22:42:58 +0100, Rahan wrote:

> Hello everybody,
>
> 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.



while ! ssh otherhost test -f filename
do
scp filename otherhost:. || sleep 60
done

  Réponse avec citation
Vieux 09/11/2007, 18h40   #3
Claudio
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Transfert file with scp (ssh)

On 2007-11-08, Rahan <Rahan@rahan.net> wrote:
> Hello everybody,
>
> 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.

Best regards,
Claudio
  Réponse avec citation
Vieux 09/11/2007, 19h00   #4
Chris F.A. Johnson
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Transfert file with scp (ssh)

On 2007-11-09, Claudio wrote:
> On 2007-11-08, Rahan <Rahan@rahan.net> 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
  Réponse avec citation
Vieux 09/11/2007, 19h13   #5
Kenny McCormack
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Transfert file with scp (ssh)

In article <slrnfj9acm.hp8.claudio@example.org>,
Claudio <claudio@example.org> wrote:
>On 2007-11-08, Rahan <Rahan@rahan.net> wrote:
>> Hello everybody,
>>
>> 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.


Which shell are you using (where $0 is the return value) ?

  Réponse avec citation
Vieux 09/11/2007, 19h54   #6
Claudio
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Transfert file with scp (ssh)

On 2007-11-09, Chris F.A. Johnson <cfajohnson@gmail.com> wrote:
> On 2007-11-09, Claudio wrote:
>> On 2007-11-08, Rahan <Rahan@rahan.net> 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.
>


Ops!

sure. My mistake. I'm very sorry.

<tested>
scp name-of-file machine:path
while [ $? -ne 0 ]; do
echo cannot copy. Waiting...
sleep 300
scp name-of-file machine:path
done
</tested>

Best regards,
Claudio.

  Réponse avec citation
Vieux 11/11/2007, 19h44   #7
Rahan
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Transfert file with scp (ssh)

Hello and thanks to all for your answers.

Cdlt
Rahan
  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 07h08.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,11300 seconds with 15 queries