kumar_m_kiran
kumar_m_kiran

Reputation: 4022

ANT execute/capture the remote command/script result

I am very new to ANT and its working, so spare me if this question is too primitive :).

Background :

I have my TOMCAT and ANT set-up in my Windows Server.
I will have to build project in multiple remote target OS - AIX/HP/SUSE.
So I have created a set of plugins (.xml files having ANT code) and execute in sequence to attain the final build package.

Problem Description :
In the process of build execution, I need to execute some task in the remote machine (i.e AIX/HP/SUSE) servers and then based on the result, need to take action.
Like for example -

These mostly will be written in shell scripts (which can be run in all 3 OS) -will return 1 for failure and 0 for success.

Question :

Upvotes: 1

Views: 1554

Answers (1)

martin clayton
martin clayton

Reputation: 78155

Suggest you consider using the Ant sshexec task. You'll probably need to get the Ant-external JSch library to use it, unless you already have it. The sshexec task can be set up to fail when the remote command fails, also you can capture the output from the remote command to a property.

Also, as you're new to Ant I suggest you browse the Ant tasks overview to get a feel for what Ant can do.

Upvotes: 1

Related Questions