ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Phillips, Rick" <Rick.Phill...@emergis.com>
Subject sshexec problem with scripts running "set -x"
Date Tue, 28 Jun 2005 15:05:56 GMT
I have a fairly large ant project I'm trying to move from ant 1.5.4 to
1.6.5.  The current build (1.5.4) does an exec of the UNIX "scp" and
"ssh" commands to deploy the built products to the numerous environments
I support.  
 
As part of moving to ant 1.6.5, I want to use the ant "scp" and
"sshexec" optional tasks.  The "scp" task works without any problems.
The "sshexec" task works, but the output I get back from the execution
of the installation script on the remote machine is almost
unusable/unreadable.  I believe the problem is relate to the fact that
the remote scripts run with "set -x".  The lines that are echoed by the
shell are output by ant as one word per line.  The following is fragment
from the same install run by exec'ing the ssh command and then by using
the "sshexec" task.
 
Any suggestions for solving this problem would be greatly appreciated.
 
Example,  exec "ssh" command:
 
    build.xml fragment:
 
        <target name="install-sm" if="BUILD.SM">
                <record name="${LOGS.DIR}/sm-install_log.txt"
action="start"/>
                <antcall target="ssh">
                        <param name="server.host"
value="${sm.agent.host}"/>
                        <param name="server.userid" value="${sm.user}"/>
                        <param name="script" value="cd ${deploy.depot}
&amp;&amp; chmod 700 install-${deploy-package-prefix-sm}.sh &amp;&amp;
./install-${deploy-package-prefix-sm}.sh &apos;${db.dba.passwd}&apos;
&apos;${sm.admin.passwd}&apos;"/>
                </antcall>
                <record name="sm-install_log.txt" action="stop"/>
        </target>
 
        <target name="ssh" description="Runs commands on distibuted
hosts.">
                <echo message="server.host=${server.host}"/>
                <echo message="server.userid=${server.userid}"/>
                <echo message="script=${script}"/>
                <exec executable="ssh" failonerror="true">
                        <arg value="-o"/>
                        <arg value="batchmode=yes"/>
                        <arg value="${server.userid}@${server.host}"/>
                        <arg value=". .profile; ${script}"/>
                </exec>
        </target>
 
    Sample output from exec "ssh":
 
        install-sm:
 
        ssh:
             [echo] server.host=arwen
             [echo] server.userid=proto2
             [echo] script=cd /usr/local/home/dropoff/deploy/proto2 &&
chmod 700 install-proto2-all_fulldata_tnwipe-sm.sh &&
./install-proto2-all_fulldata_tnwipe-sm.sh 'dbboss' 'proto2admin^'
             [exec] $Header:
/u01/projects/cvs/omega/build/scripts/deploy/install_sm.sh,v 1.37
2005/02/15 18:25:29 ssaksa Exp $
             [exec] + setup_logging scripts/install_sm.sh.log
             [exec] LOGFILE=scripts/install_sm.sh.log
             [exec] MAILTO=
             [exec] + [ ! -z scripts/install_sm.sh.log ]
             [exec] OPIPE=.27956.outpipe
             [exec] + [ ! -z  ]
             [exec] + has_tokens scripts/install_sm.sh
             [exec] + mkfifo .27956.outpipe
               .
               .
               .
 
 
Example,  sshexec task:
 
    build.xml fragment:
 
        <target name="install-sm" if="BUILD.SM">
                <record name="${LOGS.DIR}/sm-install_log.txt"
action="start"/>
                <sshexec host="${sm.agent.host}" username="${sm.user}"
keyfile="${HOME}/.ssh/id_dsa" passphrase=" " command=". ./.profile
&amp;&amp; cd ${deploy.depot} &amp;&amp; chmod 700
install-${deploy-package-prefix-sm}.sh &amp;&amp;
./install-${deploy-package-prefix-sm}.sh &apos;${db.dba.passwd}&apos;
&apos;${sm.admin.passwd}&apos;"/>
                <record name="sm-install_log.txt" action="stop"/>
        </target>
 
   Sample output from task "sshexec":
 
        install-sm:
          [sshexec] Connecting to arwen:22
          [sshexec] $Header:
/u01/projects/cvs/omega/build/scripts/deploy/install_sm.sh,v 1.37
2005/02/15 18:25:29 ssaksa Exp $
          [sshexec] +
          [sshexec] setup_logging
          [sshexec]
          [sshexec] scripts/install_sm.sh.log
          [sshexec]
 
          [sshexec] LOGFILE=scripts/install_sm.sh.log
 
          [sshexec] MAILTO=
 
          [sshexec] +
          [sshexec] [
          [sshexec]
          [sshexec] !
         [sshexec]
          [sshexec] -z
          [sshexec]
          [sshexec] scripts/install_sm.sh.log
          [sshexec]
          [sshexec] ]
          [sshexec]
 
          [sshexec] OPIPE=.27057.outpipe
 
          [sshexec] +
          [sshexec] [
          [sshexec]
          [sshexec] !
          [sshexec]
          [sshexec] -z
          [sshexec]
          [sshexec]
          [sshexec] ]
          [sshexec]
 
          [sshexec] +
          [sshexec] mkfifo
          [sshexec]
          [sshexec] .27057.outpipe
          [sshexec]
              .
              .
              .
 
Thanks in advance
Rick Phillips
rick.phillips@emergis.com
703-852-7847
Fiserv. - eLending Solutions 
1600 International Drive, 2nd Floor 
McLean, VA  22102 
 
 

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message