How can I use ant to execute commands on linux?

I would like to use ant to exectue a command like below:

<exec executable="echo ptc@123 | sudo -S /app/Windchill_10.0/Apache/bin/apachectl -k stop">
</exec>

But it replies an error say

The ‘ characters around the executable and arguments are not part of the command.

The background is: I want to use ant to stop the apache server but it doesn’t installed by the same user I run the command.

Anyone could help or give me some clues?

Thanks in advance

Leave a Comment