ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Maureen Troendle <troen...@ca.ibm.com>
Subject sshexec behaviour
Date Tue, 15 Feb 2011 23:04:22 GMT
I'm using Ant version 1.7.0 on AIX 5.3 servers and I'm seeing some odd 
behavior, just wondering if anyone else has encountered this.  I'm copying 
some zip files over to another server, unzipping them, ssh'ing and doing a 
chmod u+x, then trying to execute one of the scripts.
It seems everytime I add an sshexec to execute a script, I lose my chmod 
permission changes.  I can do an ls -al before and after the chmod in the 
same sshexec line and see the permissions change.   I can also run a 2nd 
sshexec with ls -al and see the permissions are still correct.  When I add 
the additional sshexec to try and execute one of the scripts, I get errors 
and I see that the permissions change on the remote server is not there.

So either I'm getting false reporting on which line is failing and the 
chmod is inconsistently failing or somehow the sshexec to run the script 
is somehow affecting the previous ssh command.  If the first sshexec for 
the chmod failed due to server timeout or something similar, I would 
expect an error like "Remote command failed with exit status -1" not the 
errors I am seeing flagging the script executing sshexec line.

It seems as though I need to remove the script executing sshexec line to 
get the chmod to work again. (ie. multiple reruns of script doesn't help). 
 I can see in the output of the execution that it is getting changed, yet 
when I look on the remote server the perms are not changed?

I've tried to test out a few theories like:
1. does a regular cmd rather than sshexec succeed after the chmod sshexec 
and are perms still correct - yes (echo)
2. is it being caused by the user being in the folders that are being 
removed/recreated on remote server while that activity is running - no
3. can I run a different sshexec cmd and have it succeed - yes, sshexec 
with ls -al succeeds

If anyone has any ideas or suggestions, I'd appreciated them.

Here's a sample of the code:
    <echo message="== make scripts executable at 
${target.fldr.path}/Workbooks/s
cripts/DeploymentScripts ==" />
    <sshexec host="${target.server}" username="${target.user}" 
password="${targe
t.password}" failonerror="true" trust="true" output="${target.log}" 
append="true
" command="cd ${target.fldr.path}/Workbooks/scripts/DeploymentScripts; ls 
-al; c
hmod u+x ${target.fldr.path}/Workbooks/scripts/DeploymentScripts/*.ksh; ls 
-al"
/>
    <echo message="== did config stick after adding a next cmd ==" />
    <echo message="== see if problem is user in folder when executing 
chmod =="
/>
    <echo message="== remove ^Ms from 
${target.fldr.path}/Workbooks/scripts/Depl
oymentScripts ==" />               <- misnomer here, running sshexec with 
ls -al
    <sshexec host="${target.server}" username="${target.user}" 
password="${targe
t.password}" failonerror="true" trust="true" output="${target.log}" 
append="true
" command="cd ${target.fldr.path}/Workbooks/scripts/DeploymentScripts; ls 
-al"/>

    <echo message="== remove ^Ms from 
${target.fldr.path}/Workbooks/scripts/Depl
oymentScripts ==" />
    <sshexec host="${target.server}" username="${target.user}" 
password="${targe
t.password}" failonerror="true" trust="true" output="${target.log}" 
append="true
" 
command="${target.fldr.path}/Workbooks/scripts/DeploymentScripts/remove_contro
lM.ksh ksh" />

And a sample of the output:
     [echo] == make scripts executable at 
/tmp/bcydeploy/D2/01_Config/Workbooks/scripts/DeploymentScripts ==
  [sshexec] Connecting to servername:22
  [sshexec] total 24                                        <- ls before 
chmod
  [sshexec] drwxr-xr-x    2 user group           256 Jan 07 09:57 .
  [sshexec] drwxr-xr-x    3 user group           256 Jan 07 09:57 ..
  [sshexec] -rw-r--r--    1 user group          1657 Feb 08 17:48 
Iterm_Config_Workbook_loading.csv
  [sshexec] -rw-r--r--    1 user group          3788 Oct 07 09:17 
bcyConfigureITERM.ksh
  [sshexec] -rw-r--r--    1 user group          531 Mar 16 2010 
remove_controlM.ksh
  [sshexec] total 24                                          <- ls after 
chmod
  [sshexec] drwxr-xr-x    2 user group           256 Jan 07 09:57 .
  [sshexec] drwxr-xr-x    3 user group           256 Jan 07 09:57 ..
  [sshexec] -rw-r--r--    1 user group          1657 Feb 08 17:48 
Iterm_Config_Workbook_loading.csv
  [sshexec] -rwxr--r--    1 user group          3788 Oct 07 09:17 
bcyConfigureITERM.ksh
  [sshexec] -rwxr--r--    1 user group           531 Mar 16 2010 
remove_controlM.ksh
     [echo] == did config stick after adding a next cmd ==
     [echo] == see if problem is user in folder when executing chmod ==
     [echo] == remove ^Ms from 
/tmp/bcydeploy/D2/01_Config/Workbooks/scripts/DeploymentScripts ==
  [sshexec] Connecting to servername:22
  [sshexec] total 24                                     <- ls in separate 
sshexec
  [sshexec] drwxr-xr-x    2 user group           256 Jan 07 09:57 .
  [sshexec] drwxr-xr-x    3 user group           256 Jan 07 09:57 ..
  [sshexec] -rw-r--r--    1 user group          1657 Feb 08 17:48 
Iterm_Config_Workbook_loading.csv
  [sshexec] -rwxr--r--    1 user group          3788 Oct 07 09:17 
bcyConfigureITERM.ksh
  [sshexec] -rwxr--r--    1 user group           531 Mar 16 2010 
remove_controlM.ksh
     [echo] == remove ^Ms from 
/tmp/bcydeploy/D2/01_Config/Workbooks/scripts/DeploymentScripts ==
  [sshexec] Connecting to servername:22         <- with only 1 run of cmd, 
looks like succeeds but doesn't execute properly on files, if repeat 
command with other options/methods, get failures

BUILD SUCCESSFUL
Total time: 39 seconds

2nd sample of output showing failures
  [sshexec] Connecting to servername:22
     [echo] == make scripts executable at 
/tmp/bcydeploy/D2/01_Config/Workbooks/scripts/DeploymentScripts ==
  [sshexec] Connecting to servername:22            <-extra ls's around 
chmod were removed
     [echo] == did config stick after adding a next cmd ==
     [echo] == see if problem is user in folder when executing chmod ==
     [echo] == remove ^Ms from 
/tmp/bcydeploy/D2/01_Config/Workbooks/scripts/DeploymentScripts ==
  [sshexec] Connecting to servername:22            <-separate ls in own 
sshexec
  [sshexec] total 24
  [sshexec] drwxr-xr-x    2 user group           256 Jan 07 09:57 .
  [sshexec] drwxr-xr-x    3 user group           256 Jan 07 09:57 ..
  [sshexec] -rw-r--r--    1 user group          1657 Feb 08 17:48 
Iterm_Config_Workbook_loading.csv
  [sshexec] -rwxr--r--    1 user group         3788 Oct 07 09:17 
bcyConfigureITERM.ksh
  [sshexec] -rwxr--r--    1 user group           531 Mar 16 2010 
remove_controlM.ksh
     [echo] == remove ^Ms from 
/tmp/bcydeploy/D2/01_Config/Workbooks/scripts/DeploymentScripts ==
  [sshexec] Connecting to servername:22
  [sshexec] ksh: 
/tmp/bcydeploy/D2/01_Config/Workbooks/scripts/DeploymentScripts/remove_controlM.ksh: 
cannot execute

BUILD FAILED
/path/bcydeploy.xml:191: Remote command failed with exit status 126

Code generating 2nd sample
    <echo message="== make scripts executable at 
${target.fldr.path}/Workbooks/s
cripts/DeploymentScripts ==" />
    <sshexec host="${target.server}" username="${target.user}" 
password="${targe
t.password}" failonerror="true" trust="true" output="${target.log}" 
append="true
" command="chmod u+x 
${target.fldr.path}/Workbooks/scripts/DeploymentScripts/*.k
sh" />
    <echo message="== did config stick after adding a next cmd ==" />
    <echo message="== see if problem is user in folder when executing 
chmod =="
/>
    <echo message="== remove ^Ms from 
${target.fldr.path}/Workbooks/scripts/Depl
oymentScripts ==" />
    <sshexec host="${target.server}" username="${target.user}" 
password="${targe
t.password}" failonerror="true" trust="true" output="${target.log}" 
append="true
" command="cd ${target.fldr.path}/Workbooks/scripts/DeploymentScripts; ls 
-al"/>

    <echo message="== remove ^Ms from 
${target.fldr.path}/Workbooks/scripts/Depl
oymentScripts ==" />
    <sshexec host="${target.server}" username="${target.user}" 
password="${targe
t.password}" failonerror="true" trust="true" output="${target.log}" 
append="true
" command="cd ${target.fldr.path}/Workbooks/scripts/DeploymentScripts; 
${target.
fldr.path}/Workbooks/scripts/DeploymentScripts/remove_controlM.ksh ksh; 
${target
.fldr.path}/Workbooks/scripts/DeploymentScripts/remove_controlM.ksh csv" 
/>


Regards,
Maureen



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