Ant telnet is hanging on a simple task

Posted by Sagar on Stack Overflow See other posts from Stack Overflow or by Sagar
Published on 2010-04-28T15:57:13Z Indexed on 2010/04/28 16:13 UTC
Read the original article Hit count: 257

Filed under:
|
<?xml version="1.0" ?>
<project name="test" default="root">
    <target name="telnet">
        <telnet server="10.1.1.1">
            <read>login:</read>
            <write>root</write>
            <read>password:</read>
            <write>${PASSWORD}</write>
            <read>#</read>
            <write>ls</write>
            <read>#</read>
        </telnet>
    </target>
</project>

That is the code I have in a build.xml file. When I run ant (version 1.8, in bash) (I have downloaded and copied over the jars for commons-net-2.0 and jakarta-oro-2.0.8 already), this is the output I get:

Buildfile: /home/sagar/build.xml

telnet:

and then it just sits there. When I do a "who" on my server, I can see "System" waiting on login. But there is no progress after this. I can telnet into the server using normal telnet means (putty, bash, etc).

I even tried the full telnet command instead of read/write:

<telnet server="10.1.1.1" userid="root" password="root">

Any help is much appreciated!

Note: JRE 1.5, Ant 1.8, commons-net version 2.0, jakarta version 2.0.8

© Stack Overflow or respective owner

Related posts about ant

Related posts about commons-net