You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Z W <mp...@gmail.com> on 2008/02/05 23:24:34 UTC

Check process on remote host - Can Ant do that ?

Hi

I have an ant script that needs to check the status of a process running on
a remote machine and if the
process has stopped running, I like the Ant script the ability to know that
and move on to the next step in Ant script.
Could someone here give a simple example on how to implement that ?
I have some idea of using sleep to periodically check for a remote process
but
is there an Ant task or a workaround that I could implement to check the
process using ps ?
I'm not sure sshexec could help me with that.

Thank you all for your helpful tips and comments

Re: Check process on remote host - Can Ant do that ?

Posted by Steve Loughran <st...@apache.org>.
Z W wrote:
> Steve L
> Thanks for your response.
> Sounds like another huge learning curve for me.
> Is there any other way in Ant besides having to learn sf ?
> I'm unsure if I have the time bandwidth to experiment with.


1. If you can use conditions to check for the remote state, then you can 
do stuff too. Here's some of my ant-based deployment tests that probe a 
URL using <waitfor> and then run some <get> operations until my test 
pages are happy



   <target name="wait" depends="deploy-properties">
     <fail unless="application.url" >No application.url defined</fail>
     <property name="deploy.sleep" value="5"/>
     <property name="deploy.waittime" value="20" />
     <sleep seconds="5"/>
     <waitfor maxwait="${deploy.waittime}"
         maxwaitunit="second">
       <http url="${application.url}" />
     </waitfor>
   </target>

   <target name="wait-undeploy" depends="undeploy">
     <property name="undeploy.waittime" value="10"/>
     <waitfor maxwait="${undeploy.waittime}"
         maxwaitunit="second">
       <not>
         <http url="${application.url}"/>
       </not>
     </waitfor>
   </target>

   <target name="get" depends="deploy,wait">
     <get src="${application.url}happy.jsp"
         dest="${build.dir}/happy.html"/>
     <get src="${application.url}feed/"
         dest="${build.dir}/feed.xml"/>
   </target>

   <!--this is our state-->
   <target name="deployed" depends="get"
       description="the application is in a deployed state"/>


   <target name="undeployed" depends="undeploy"/>


As well as <http>, there's a <socket> condition that looks for a port 
being open on a local/remote machine

2. Puppet, by Luke Kanias, is another (ruby-based) configuration 
management tool. Unix only; good a low level system config management, 
but not so good at Java application configuration.

3.  Build and publish your own RPM/deb files.

On linux, you can use the <rpmbuild> task to create new RPM files; you 
can then <scp> up these RPMs, and install them -or push them out to a 
server farm using yum or similar. This lets you manage hundreds of 
machines, machines that must be set up to pull down files from your 
central repository

RPMs can run code at install/uninstall time, so can start and stop 
services. They are very, very hard to get right though, especially 
robust uninstall scripts. I've found it easier to not put any scripts 
there and require the users to shut things down cleanly.


4. Write complex scripts and run them on the remote boxes

for this to work best, I'd encourage you to move away from bash or 
similar, and push out Ant, Perl or Ruby files to the remote boxes, and 
run them there. If you use Ant, there are some Remote Ant tools that you 
can search for; I think ant.apache.org covers them. Its much easier for 
a build file on the remote system to test stuff and act on it, than it 
is for a local build file to try and manage it. If you are deploying to 
app servers, you already have enough of  a JVM installed to host ant...


I'm slowly building up a set of articles on deployment/configuration on 
a wiki:
   http://wiki.smartfrog.org/wiki/display/sf/Patterns+of+Deployment
Have a look if you have some time.

-steve



-- 
Steve Loughran                  http://www.1060.org/blogxter/publish/5
Author: Ant in Action           http://antbook.org/

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: Check process on remote host - Can Ant do that ?

Posted by Z W <mp...@gmail.com>.
Steve L
Thanks for your response.
Sounds like another huge learning curve for me.
Is there any other way in Ant besides having to learn sf ?
I'm unsure if I have the time bandwidth to experiment with.

Thanks

Re: Check process on remote host - Can Ant do that ?

Posted by Steve Loughran <st...@apache.org>.
David Brown wrote:
> Hello Steve, this is the wrong ML so I will keep it short. I have complete steps 1 and 2 below. There is not if any traffic on the smartfrog-users ML. I cannot the the smarfrog or sfDaemon to start to be able to complete step #3. What is the best venue to get some advice? Please advise, David.


I think Julio answered on the mailing list, but we still need to find 
out what's wrong. see you on the other list...

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: Check process on remote host - Can Ant do that ?

Posted by David Brown <da...@davidwbrown.name>.
Hello Steve, this is the wrong ML so I will keep it short. I have complete steps 1 and 2 below. There is not if any traffic on the smartfrog-users ML. I cannot the the smarfrog or sfDaemon to start to be able to complete step #3. What is the best venue to get some advice? Please advise, David.

Steve Loughran wrote ..
> David Brown wrote:
> > Hello Steve, I am subscribed to various MLs such as Ant and Tomcat because I
> seem to find something that grabs my interest almost daily. And, the smartfrog
> link below is no exception. I went directly to smartfrog and I have been reading
> avidly for several hours. 
> 
> 
> 
> >And, I agree with the rhetoric so far that smartfrog is not arcane but is overwhelming
> to the new user because of all the features (reminds me of JMeter). 
> 
> 
> >My current gig is a Tomcat/JBoss assessment for a company that is in dire need
> of performance tuning and some type of vertical of horizontal scaling 
>  >such that their current web app and web service installations can 
> scale up to 25k users. I am currently using JMeter for remote 
> distributed testing
>  > but what I need more are multiple instances of their servlet 
> containers (Tomcat & JBoss). JBoss lends it self to multiple instances 
> very handily
>  >but their current Tomcat 5.5 by what I have seen on the Tomcat ML can 
> be problematic to configure and difficult to maintain as a
>  >stable multiple instance server. My question is (before I spend a 
> gazillion hours working-out the smartfrog examples) can smartfrog help
>  > toward creating a computing grid using disparate machines and 
> disparate systems of disparate JDKs/JREs and disparate Tomcat versions?
> 
> disparate JDKs is trouble. What we like to do in that world is push out 
> the right JDK versions, usually by uploading and installing the RPMs. 
> That said, as long as you are running java5+, SmartFrog is happy.
> 
> The way to view SmartFrog is the components and the runtimes to do large 
> cluster systems, but not some nice shrink-wrapped tool to do it for you. 
> What we use for big systems is:
> 
> - Anubis ( http://wiki.smartfrog.org/wiki/display/sf/Anubis ) so that 
> deployed nodes can find each other without a central manager. This is a 
> tuple space that notifies peers on a LAN when nodes come and go.
> 
> -a special anubisdeployer that deploys work to any machine matching the 
> requirements
> 
> -a CpuMonitor component that runs vmstat to determine current system 
> load. This is used to trigger requests new machines, and for machines to 
> declare themselves idle, when they can be returned to the pool.
> 
> There's a big dynamicwebserver example that installs and runs apache 
> httpd on demand; Supporting Tomcat should be similar; its just not (yet) 
> something anyone's put together
> 
>  >What are the advantages of smartfrog over just using JMeter and 
> load-balancing? I read the PDF whitepaper: Globus Toolkit and smartfrog 
> but that reading did not lead to anymore confidence.
>  > What happened to the day when I had time to read the Loughran/Hatcher 
> Ant book and then go-to-work? Please advise, David.
> 
> I dont know what happened to time either.
> 
> Where things get interesting over basic load balancing is when you 
> allocate real/virtual machines on demand. With virtualisation (I'm doing 
> stuff with amazon's EC2 farm right now), you really can do interesting 
> stuff. There's some VMWare components being done in the Open Source 
> repository; demand allocation of VMs followed by configuration of the 
> deployed machines. This is both cost effective and agile.
> 
> see also: 
> http://people.apache.org/~stevel/slides/farms_fabrics_and_clouds.pdf
> 
> 
> What I'd recommend you do is
>   1. grab today's release, preferably the self-installing JAR or the 
> linux RPMs
>  
> http://sourceforge.net/project/showfiles.php?group_id=87384&package_id=108447&release_id=576780
> 
>   2. Get on the smartfrog-users mailing list and discuss what you want 
> to do; see if we can't come up with the right combination of things:
>   http://sourceforge.net/mailarchive/forum.php?forum_name=smartfrog-users
> 
> 3. Pick something small, like database+app server, before going for the 
> 200+ node server farms.
> 
> -steve
> 
> 
> 
> -- 
> Steve Loughran                  http://www.1060.org/blogxter/publish/5
> Author: Ant in Action           http://antbook.org/
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: Check process on remote host - Can Ant do that ?

Posted by Steve Loughran <st...@apache.org>.
David Brown wrote:
> Hello Steve, I am subscribed to various MLs such as Ant and Tomcat because I seem to find something that grabs my interest almost daily. And, the smartfrog link below is no exception. I went directly to smartfrog and I have been reading avidly for several hours. 



>And, I agree with the rhetoric so far that smartfrog is not arcane but is overwhelming to the new user because of all the features (reminds me of JMeter). 


>My current gig is a Tomcat/JBoss assessment for a company that is in dire need of performance tuning and some type of vertical of horizontal scaling 
 >such that their current web app and web service installations can 
scale up to 25k users. I am currently using JMeter for remote 
distributed testing
 > but what I need more are multiple instances of their servlet 
containers (Tomcat & JBoss). JBoss lends it self to multiple instances 
very handily
 >but their current Tomcat 5.5 by what I have seen on the Tomcat ML can 
be problematic to configure and difficult to maintain as a
 >stable multiple instance server. My question is (before I spend a 
gazillion hours working-out the smartfrog examples) can smartfrog help
 > toward creating a computing grid using disparate machines and 
disparate systems of disparate JDKs/JREs and disparate Tomcat versions?

disparate JDKs is trouble. What we like to do in that world is push out 
the right JDK versions, usually by uploading and installing the RPMs. 
That said, as long as you are running java5+, SmartFrog is happy.

The way to view SmartFrog is the components and the runtimes to do large 
cluster systems, but not some nice shrink-wrapped tool to do it for you. 
What we use for big systems is:

- Anubis ( http://wiki.smartfrog.org/wiki/display/sf/Anubis ) so that 
deployed nodes can find each other without a central manager. This is a 
tuple space that notifies peers on a LAN when nodes come and go.

-a special anubisdeployer that deploys work to any machine matching the 
requirements

-a CpuMonitor component that runs vmstat to determine current system 
load. This is used to trigger requests new machines, and for machines to 
declare themselves idle, when they can be returned to the pool.

There's a big dynamicwebserver example that installs and runs apache 
httpd on demand; Supporting Tomcat should be similar; its just not (yet) 
something anyone's put together

 >What are the advantages of smartfrog over just using JMeter and 
load-balancing? I read the PDF whitepaper: Globus Toolkit and smartfrog 
but that reading did not lead to anymore confidence.
 > What happened to the day when I had time to read the Loughran/Hatcher 
Ant book and then go-to-work? Please advise, David.

I dont know what happened to time either.

Where things get interesting over basic load balancing is when you 
allocate real/virtual machines on demand. With virtualisation (I'm doing 
stuff with amazon's EC2 farm right now), you really can do interesting 
stuff. There's some VMWare components being done in the Open Source 
repository; demand allocation of VMs followed by configuration of the 
deployed machines. This is both cost effective and agile.

see also: 
http://people.apache.org/~stevel/slides/farms_fabrics_and_clouds.pdf


What I'd recommend you do is
  1. grab today's release, preferably the self-installing JAR or the 
linux RPMs
 
http://sourceforge.net/project/showfiles.php?group_id=87384&package_id=108447&release_id=576780

  2. Get on the smartfrog-users mailing list and discuss what you want 
to do; see if we can't come up with the right combination of things:
  http://sourceforge.net/mailarchive/forum.php?forum_name=smartfrog-users

3. Pick something small, like database+app server, before going for the 
200+ node server farms.

-steve



-- 
Steve Loughran                  http://www.1060.org/blogxter/publish/5
Author: Ant in Action           http://antbook.org/

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: Check process on remote host - Can Ant do that ?

Posted by David Brown <da...@davidwbrown.name>.
Hello Steve, I am subscribed to various MLs such as Ant and Tomcat because I seem to find something that grabs my interest almost daily. And, the smartfrog link below is no exception. I went directly to smartfrog and I have been reading avidly for several hours. And, I agree with the rhetoric so far that smartfrog is not arcane but is overwhelming to the new user because of all the features (reminds me of JMeter). My current gig is a Tomcat/JBoss assessment for a company that is in dire need of performance tuning and some type of vertical of horizontal scaling such that their current web app and web service installations can scale up to 25k users. I am currently using JMeter for remote distributed testing but what I need more are multiple instances of their servlet containers (Tomcat & JBoss). JBoss lends it self to multiple instances very handily but their current Tomcat 5.5 by what I have seen on the Tomcat ML can be problematic to configure and difficult to maintain as a s
 table multiple instance server. My question is (before I spend a gazillion hours working-out the smartfrog examples) can smartfrog help toward creating a computing grid using disparate machines and disparate systems of disparate JDKs/JREs and disparate Tomcat versions? What are the advantages of smartfrog over just using JMeter and load-balancing? I read the PDF whitepaper: Globus Toolkit and smartfrog but that reading did not lead to anymore confidence. What happened to the day when I had time to read the Loughran/Hatcher Ant book and then go-to-work? Please advise, David.


Steve Loughran wrote ..
> Z W wrote:
> > Oliver
> > I thought about that but it wouldn't solve the problem because I don't know
> > when exactly the process dies
> > 
> 
> 
> What you're  effectively trying to do here is monitor remote processes; 
> you've jump from build time to run time/management problems.
> 
> More subtly, its not enough to check that the process is present, you 
> need to be sure it is *alive*. If you can monitor the external side 
> effect of a process (http get, telnet to a port, make a JDBC call) then 
> you can see if a system is actually alive as far as an outside caller is 
> concerned. This is the best thing you can do.
> 
> Now, I work full time on deploying and managing very large/complex/high 
> availability systems; the core runtime we use is freely (i.e. LPGL) 
> available at http://smartfrog.org/ / SmartFrog is not a build tool, its 
> there to configure and coordinate big systems.
> 
> I think it sounds like your project is reaching the stage where it needs 
> this kind of tool...
> 
> 
> -- 
> Steve Loughran                  http://www.1060.org/blogxter/publish/5
> Author: Ant in Action           http://antbook.org/
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: Check process on remote host - Can Ant do that ?

Posted by Steve Loughran <st...@apache.org>.
Z W wrote:
> Oliver
> I thought about that but it wouldn't solve the problem because I don't know
> when exactly the process dies
> 


What you're  effectively trying to do here is monitor remote processes; 
you've jump from build time to run time/management problems.

More subtly, its not enough to check that the process is present, you 
need to be sure it is *alive*. If you can monitor the external side 
effect of a process (http get, telnet to a port, make a JDBC call) then 
you can see if a system is actually alive as far as an outside caller is 
concerned. This is the best thing you can do.

Now, I work full time on deploying and managing very large/complex/high 
availability systems; the core runtime we use is freely (i.e. LPGL) 
available at http://smartfrog.org/ / SmartFrog is not a build tool, its 
there to configure and coordinate big systems.

I think it sounds like your project is reaching the stage where it needs 
this kind of tool...


-- 
Steve Loughran                  http://www.1060.org/blogxter/publish/5
Author: Ant in Action           http://antbook.org/

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: Check process on remote host - Can Ant do that ?

Posted by Z W <mp...@gmail.com>.
Oliver
I thought about that but it wouldn't solve the problem because I don't know
when exactly the process dies

On Feb 12, 2008 7:39 PM, Olivier Gies <ol...@bull.net> wrote:

> Maybe you can implement a condition to be used with Ant's core <waitfor>
> task...
>
> Olivier
>
> -------- Original Message  --------
> Subject: Re: Check process on remote host - Can Ant do that ?
> From: Z W <mp...@gmail.com>
> To: Ant Users List <us...@ant.apache.org>
> Date: 06/02/2008 15:10
> > Thanks for responding.
> > But how do I make a conditional infinite loop with it ?
> > Is there an Ant task for infinite loop ?
> >
> > ie
> > while (1)
> > {
> >    sshexec_check_remote_process_on_remote_host
> >    if (remote_process == dead)
> >    break;
> >    else
> >    sleep 10 mins
> > }
> >
> > On Feb 5, 2008 3:39 PM, Charbel BITAR <bi...@gmail.com> wrote:
> >
> >
> >> As you said use the <sshexec> task.
> >> Here's an example :
> >> ...
> >> <property name="sshexec.host" value="" />
> >> <property name="sshexec.username" value="" />
> >> <property name="sshexec.password" value="" />
> >> <property name="sshexec.trust" value="" />
> >> <property name="sshexec.failonerror" value="" />
> >>  <property name="sshexec.timeout" value="" />
> >> <property name="sshexec.command" value='ps -ef | cut -d" " -f5 | grep
> >> 11875'
> >> />
> >> ...
> >> <target name="sshexec" description="SSHExec">
> >>  <sshexec host="${sshexec.host}" username="${sshexec.username}"
> >> password="${
> >> sshexec.password}" trust="${sshexec.trust}" failonerror="${
> >> sshexec.failonerror}" timeout="${sshexec.timeout}" command="${
> >> sshexec.command}" outputproperty="sshexec.outputproperty" />
> >> ...Use a condition to check that ${sshexec.outputproperty} !equals the
> >> empty
> >> string...
> >> </target>
> >> ...
> >>
> >> HTH
> >> --
> >> Charbel
> >>
> >>
> >>
> >> On Feb 5, 2008 11:24 PM, Z W <mp...@gmail.com> wrote:
> >>
> >>
> >>> Hi
> >>>
> >>> I have an ant script that needs to check the status of a process
> running
> >>> on
> >>> a remote machine and if the
> >>> process has stopped running, I like the Ant script the ability to know
> >>> that
> >>> and move on to the next step in Ant script.
> >>> Could someone here give a simple example on how to implement that ?
> >>> I have some idea of using sleep to periodically check for a remote
> >>>
> >> process
> >>
> >>> but
> >>> is there an Ant task or a workaround that I could implement to check
> the
> >>> process using ps ?
> >>> I'm not sure sshexec could help me with that.
> >>>
> >>> Thank you all for your helpful tips and comments
> >>>
> >>>
> >
> >
>
> --
>
> *Olivier Gies*
>
> *Delivery Manager
> Customs & Tax Software Engineering Center
> Bull, Architect of an Open World ^TM
> Phone: +86 (10) 65978001 - Ext 555 *
>
> *www.bull.com <http://www.bull.com/>*
>
> *This e-mail contains material that is confidential for the sole use of
> the intended recipient. Any review, reliance or distribution by others
> or forwarding without express permission is strictly prohibited. If you
> are not the intended recipient, please contact the sender and delete all
> copies.*
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>

Re: Check process on remote host - Can Ant do that ?

Posted by Olivier Gies <ol...@bull.net>.
Maybe you can implement a condition to be used with Ant's core <waitfor> 
task...

Olivier

-------- Original Message  --------
Subject: Re: Check process on remote host - Can Ant do that ?
From: Z W <mp...@gmail.com>
To: Ant Users List <us...@ant.apache.org>
Date: 06/02/2008 15:10
> Thanks for responding.
> But how do I make a conditional infinite loop with it ?
> Is there an Ant task for infinite loop ?
>
> ie
> while (1)
> {
>    sshexec_check_remote_process_on_remote_host
>    if (remote_process == dead)
>    break;
>    else
>    sleep 10 mins
> }
>
> On Feb 5, 2008 3:39 PM, Charbel BITAR <bi...@gmail.com> wrote:
>
>   
>> As you said use the <sshexec> task.
>> Here's an example :
>> ...
>> <property name="sshexec.host" value="" />
>> <property name="sshexec.username" value="" />
>> <property name="sshexec.password" value="" />
>> <property name="sshexec.trust" value="" />
>> <property name="sshexec.failonerror" value="" />
>>  <property name="sshexec.timeout" value="" />
>> <property name="sshexec.command" value='ps -ef | cut -d" " -f5 | grep
>> 11875'
>> />
>> ...
>> <target name="sshexec" description="SSHExec">
>>  <sshexec host="${sshexec.host}" username="${sshexec.username}"
>> password="${
>> sshexec.password}" trust="${sshexec.trust}" failonerror="${
>> sshexec.failonerror}" timeout="${sshexec.timeout}" command="${
>> sshexec.command}" outputproperty="sshexec.outputproperty" />
>> ...Use a condition to check that ${sshexec.outputproperty} !equals the
>> empty
>> string...
>> </target>
>> ...
>>
>> HTH
>> --
>> Charbel
>>
>>
>>
>> On Feb 5, 2008 11:24 PM, Z W <mp...@gmail.com> wrote:
>>
>>     
>>> Hi
>>>
>>> I have an ant script that needs to check the status of a process running
>>> on
>>> a remote machine and if the
>>> process has stopped running, I like the Ant script the ability to know
>>> that
>>> and move on to the next step in Ant script.
>>> Could someone here give a simple example on how to implement that ?
>>> I have some idea of using sleep to periodically check for a remote
>>>       
>> process
>>     
>>> but
>>> is there an Ant task or a workaround that I could implement to check the
>>> process using ps ?
>>> I'm not sure sshexec could help me with that.
>>>
>>> Thank you all for your helpful tips and comments
>>>
>>>       
>
>   

-- 

*Olivier Gies*

*Delivery Manager
Customs & Tax Software Engineering Center
Bull, Architect of an Open World ^TM
Phone: +86 (10) 65978001 - Ext 555 *

*www.bull.com <http://www.bull.com/>*

*This e-mail contains material that is confidential for the sole use of 
the intended recipient. Any review, reliance or distribution by others 
or forwarding without express permission is strictly prohibited. If you 
are not the intended recipient, please contact the sender and delete all 
copies.*


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: Check process on remote host - Can Ant do that ?

Posted by Z W <mp...@gmail.com>.
Thanks for responding.
But how do I make a conditional infinite loop with it ?
Is there an Ant task for infinite loop ?

ie
while (1)
{
   sshexec_check_remote_process_on_remote_host
   if (remote_process == dead)
   break;
   else
   sleep 10 mins
}

On Feb 5, 2008 3:39 PM, Charbel BITAR <bi...@gmail.com> wrote:

> As you said use the <sshexec> task.
> Here's an example :
> ...
> <property name="sshexec.host" value="" />
> <property name="sshexec.username" value="" />
> <property name="sshexec.password" value="" />
> <property name="sshexec.trust" value="" />
> <property name="sshexec.failonerror" value="" />
>  <property name="sshexec.timeout" value="" />
> <property name="sshexec.command" value='ps -ef | cut -d" " -f5 | grep
> 11875'
> />
> ...
> <target name="sshexec" description="SSHExec">
>  <sshexec host="${sshexec.host}" username="${sshexec.username}"
> password="${
> sshexec.password}" trust="${sshexec.trust}" failonerror="${
> sshexec.failonerror}" timeout="${sshexec.timeout}" command="${
> sshexec.command}" outputproperty="sshexec.outputproperty" />
> ...Use a condition to check that ${sshexec.outputproperty} !equals the
> empty
> string...
> </target>
> ...
>
> HTH
> --
> Charbel
>
>
>
> On Feb 5, 2008 11:24 PM, Z W <mp...@gmail.com> wrote:
>
> > Hi
> >
> > I have an ant script that needs to check the status of a process running
> > on
> > a remote machine and if the
> > process has stopped running, I like the Ant script the ability to know
> > that
> > and move on to the next step in Ant script.
> > Could someone here give a simple example on how to implement that ?
> > I have some idea of using sleep to periodically check for a remote
> process
> > but
> > is there an Ant task or a workaround that I could implement to check the
> > process using ps ?
> > I'm not sure sshexec could help me with that.
> >
> > Thank you all for your helpful tips and comments
> >
>

Re: Check process on remote host - Can Ant do that ?

Posted by Charbel BITAR <bi...@gmail.com>.
As you said use the <sshexec> task.
Here's an example :
...
<property name="sshexec.host" value="" />
<property name="sshexec.username" value="" />
<property name="sshexec.password" value="" />
<property name="sshexec.trust" value="" />
<property name="sshexec.failonerror" value="" />
 <property name="sshexec.timeout" value="" />
<property name="sshexec.command" value='ps -ef | cut -d" " -f5 | grep 11875'
/>
...
<target name="sshexec" description="SSHExec">
 <sshexec host="${sshexec.host}" username="${sshexec.username}" password="${
sshexec.password}" trust="${sshexec.trust}" failonerror="${
sshexec.failonerror}" timeout="${sshexec.timeout}" command="${
sshexec.command}" outputproperty="sshexec.outputproperty" />
...Use a condition to check that ${sshexec.outputproperty} !equals the empty
string...
</target>
...

HTH
--
Charbel



On Feb 5, 2008 11:24 PM, Z W <mp...@gmail.com> wrote:

> Hi
>
> I have an ant script that needs to check the status of a process running
> on
> a remote machine and if the
> process has stopped running, I like the Ant script the ability to know
> that
> and move on to the next step in Ant script.
> Could someone here give a simple example on how to implement that ?
> I have some idea of using sleep to periodically check for a remote process
> but
> is there an Ant task or a workaround that I could implement to check the
> process using ps ?
> I'm not sure sshexec could help me with that.
>
> Thank you all for your helpful tips and comments
>