Oh dear, this looks like it is going to be a lot more involved than just using the sshexec and scp tasks....

If I understand this example correctly, it appears that you are actually executing a script on the remote server so that the server uploads from the PC; Ant is just telling the server to initiate the script. Or am I misunderstanding?

Hmmm. I may just do something similar. I can write a script in WinScp3 to grab whatever files I want to send to the server and run it on the server. Then, with a bit of luck, I can coax Ant to initiate that script for me so that I don't have to start it manually.

Rhino


----- Original Message ----- From: "Rebhan, Gilbert" <[EMAIL PROTECTED]>
To: "Ant Users List" <user@ant.apache.org>
Sent: Monday, December 19, 2005 4:25 AM
Subject: RE: Question re sshexec task



Hi, Rhino

-----Original Message-----
From: Rhino [mailto:[EMAIL PROTECTED]
Sent: Sunday, December 18, 2005 3:30 PM
To: Ant Users List
Subject: Re: Question re sshexec task

/*
Could you possibly post a small example of the technique you're using?
I'm
not sure how to combine exec with ssh/scp. You can disguise the server
name,
user id, passphrase and so forth. The example doesn't need to do
anything
fancy; a simple 'pwd' and 'mkdir' would be fine.

It would really help me revise my script so that it works again!
*/

I suppose you want to work on a unix box, as i do ?!
On a windows box you could use the free putty client, which has also
a command line interface.

What i did before writing the script =

i went to our unix admins and said i want to use ssh/scp without
password,
so my script runs without hardcoded passwords or any kind of interaction
(prompts for password).

they had to fiddle in the /home/.ssh directory,
your unix admins should know what to do ;-)

My script transfers all stuff to one unix machine and does
all the rest - copy and delete on other unix machines -
via scp / ssh

here's a part of a script using ssh / scp =

[ ... ]

<assert name="[EMAIL PROTECTED]" execute="true">
<for list="[EMAIL PROTECTED]" param="delfile">
<sequential>
<echo message="Deleting File ->
${target}/@{Lum}/opt/[EMAIL PROTECTED]" />

*** Kornshell ksh , you may have another shell on your box
<exec executable="ksh" failonerror="true">

*** rm
    with Flag -r you're able delete files _and_ directories(even if not
empty)
    with Flag -f you don't get any error messages, i.e. when the file
doesn't
    exist on one of the nodes
    with Flag -e you get a message on stdout when a file is deleted

*** ssh
    you have to put the whole line between ' ' and the rm command
between " "
    just use your commands, i.e. pwd or mkdir in the same manner

<arg value='ssh @{server} "rm -r -f -e
${target}/@{Lum}/opt/[EMAIL PROTECTED]"'/>
</exec>
</sequential>
</for>
</assert>

<assert name="[EMAIL PROTECTED]" execute="true">
<for list="[EMAIL PROTECTED]" param="copyfile">
<sequential>
<echo message="Copy File -> @{copyfile}" />
<exec executable="ksh" failonerror="true">

*** scp
    with Flag -p the timestamps are preserved
    with Flag -r you may copy files _and_ directories

*** the syntax with the 5 '@' has to be written that way because of
   using ant-contrib for task

*** normally there's no linefeed after ${target}/ in my script

<arg value="scp -p -r ./@{Lum}/[EMAIL PROTECTED]
svcscmcs@@@@@{server}:${target}/@{Lum}/opt/[EMAIL PROTECTED]" />
</exec>
</sequential>
</for>
</assert>
[ ... ]


HTH

Regards, Gilbert

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.371 / Virus Database: 267.14.1/206 - Release Date: 16/12/2005




--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.371 / Virus Database: 267.14.1/206 - Release Date: 16/12/2005


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to