ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rebhan, Gilbert" <>
Subject RE: Question re sshexec task
Date Mon, 19 Dec 2005 09:25:38 GMT
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:

View raw message