ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brian Pontarelli <>
Subject Re: Killing Ant process through shell script when multiple Java processes are running...
Date Tue, 24 Nov 2009 19:51:31 GMT
It will depend on the OS that you are running and grabbing the PID. In most unix systems, the
PID of the last executed process is in the variable $!. You can store this in a file for later
retrieval if necessary. You can also add a very specific -D property and then use a combination
of the ps, grep and awk commands to figure out the PID.

java -Dmyantprocess

ps -efww | grep 'myantprocess' | awk '{print $1}'

All of this again depends on your OS and the available tools you have.


On Nov 24, 2009, at 10:32 AM, Harry_ wrote:

> Hello,
> I want to schedule a task using ant using crontab. 
> On shell script will start the ant and the task I want to run. This is easy.
> One shell script will kill the above ant process.
> But the problem is that multiple java processes are running on machine. I
> only want to kill only the ant process, How can I do that. Any Ideas. 
> Like noting process ID of ant process created above and then killing it with
> kill script. I do not know how to do this. Someone point me to link where I
> can get information about how to do this. 
> Thanks and Regards 
> -- 
> View this message in context:
> Sent from the Ant - Users mailing list archive at
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

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

View raw message