ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rhino" <>
Subject Re: Question re sshexec task
Date Mon, 19 Dec 2005 13:55:11 GMT
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 

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.


----- Original Message ----- 
From: "Rebhan, Gilbert" <>
To: "Ant Users List" <>
Sent: Monday, December 19, 2005 4:25 AM
Subject: RE: Question re sshexec task

Hi, Rhino

-----Original Message-----
From: Rhino []
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?
not sure how to combine exec with ssh/scp. You can disguise the server
user id, passphrase and so forth. The example doesn't need to do
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
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="deletelist.@{Lum}" execute="true">
<for list="${deletelist.@{Lum}}" param="delfile">
<echo message="Deleting File ->
${target}/@{Lum}/opt/andromeda@{delfile}" />

*** 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
     with Flag -f you don't get any error messages, i.e. when the file
     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

<assert name="updatelist.@{Lum}" execute="true">
<for list="${updatelist.@{Lum}}" param="copyfile">
<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}/serverdata@{copyfile}
svcscmcs@@@@@{server}:${target}/@{Lum}/opt/andromeda@{copyfile}" />
[ ... ]


Regards, Gilbert

To unsubscribe, e-mail:
For additional commands, e-mail:

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:
For additional commands, e-mail:

View raw message