I'm having trouble getting a unix script to execute through my ant script. What 
am I doing wrong?

Attempt 1 ant script snippet:

<!-- Copy the script file to the run location and chmod to make executable -->
<copy file="${basedir}/runSqlPlusUnix.sh" todir="${sql.deploy.script}"/>
<chmod file="${sql.deploy.script}/runSqlPlusUnix.sh" perm="775"/>
<exec executable="bash" dir="${sql.deploy.script}/"
    osfamily="unix">
    <arg line="runSqlPlusUnix.sh ${sql.deploy.script}"/>
</exec>

Attempt 1 verbose output:

 [if] copy
     [copy] Copying 1 file to 
/u01/ossint/TeamCityBuildAgent/work/ba331bf4546cf0c1/sql/deployment/r1-0
 [if] chmod
     [chmod] FileSet: Setup scanner in dir 
/u01/ossint/TeamCityBuildAgent/work/ba331bf4546cf0c1/sql/deployment/r1-0 with 
patternSet{ includes: [runSqlPlusUnix.sh] excludes: [] }
     [chmod] Execute:Java13CommandLauncher: Executing 'chmod' with 
arguments:'775' 
'/u01/ossint/TeamCityBuildAgent/work/ba331bf4546cf0c1/sql/deployment/r1-0/runSqlPlusUnix.sh'
    The ' characters around the executable and arguments are not part of the 
command.
 [if] exec
     [exec] Execute:Java13CommandLauncher: Executing 'bash' with 
arguments:'runSqlPlusUnix.sh' 
'/u01/ossint/TeamCityBuildAgent/work/ba331bf4546cf0c1/sql/deployment/r1-0'
    The ' characters around the executable and arguments are not part of the 
command.
     [exec] runSqlPlusUnix.sh: line 2: 
     [exec] : command not foundrunSqlPlusUnix.sh: line 5: 
     [exec] : command not foundrunSqlPlusUnix.sh: line 16: syntax error: 
unexpected end of file
     [exec] Result: 2

Attempt 2 ant script snippet:

<copy file="${basedir}/runSqlPlusUnix.sh" todir="${sql.deploy.script}"/>
<chmod file="${sql.deploy.script}/runSqlPlusUnix.sh" perm="775"/>
<exec executable="runSqlPlusUnix.sh" dir="${sql.deploy.script}"
    osfamily="unix">
    <arg value="${sql.deploy.script}"/>
</exec>

Attempt 2 verbose output (I verified that the file exists in the right location 
with the right permission after this ran):

 [if] copy
     [copy] Copying 1 file to 
/u01/ossint/TeamCityBuildAgent/work/ba331bf4546cf0c1/sql/deployment/r1-0
 [if] chmod
     [chmod] FileSet: Setup scanner in dir 
/u01/ossint/TeamCityBuildAgent/work/ba331bf4546cf0c1/sql/deployment/r1-0 with 
patternSet{ includes: [runSqlPlusUnix.sh] excludes: [] }
     [chmod] Execute:Java13CommandLauncher: Executing 'chmod' with 
arguments:'775' 
'/u01/ossint/TeamCityBuildAgent/work/ba331bf4546cf0c1/sql/deployment/r1-0/runSqlPlusUnix.sh'
    The ' characters around the executable and arguments are not part of the 
command.
 [if] exec
 [exec] Execute:Java13CommandLauncher: Executing 'runSqlPlusUnix.sh' with 
arguments:
'/u01/ossint/TeamCityBuildAgent/work/ba331bf4546cf0c1/sql/deployment/r1-0'
The ' characters around the executable and arguments are not part of the 
command.
 [exec] Execute failed: java.io.IOException: Cannot run program 
"runSqlPlusUnix.sh" (in directory 
"/u01/ossint/TeamCityBuildAgent/work/ba331bf4546cf0c1/sql/deployment/r1-0"): 
error=2, No such file or directory
 [antcall] The following error occurred while executing this line:
/u01/ossint/TeamCityBuildAgent/work/ba331bf4546cf0c1/sql/build.xml:62: Execute 
failed: java.io.IOException: Cannot run program "runSqlPlusUnix.sh" (in 
directory 
"/u01/ossint/TeamCityBuildAgent/work/ba331bf4546cf0c1/sql/deployment/r1-0"): 
error=2, No such file or directory
 [subant] The following error occurred while executing this line:
/u01/ossint/TeamCityBuildAgent/work/ba331bf4546cf0c1/sql/build.xml:28: The 
following error occurred while executing this line:
/u01/ossint/TeamCityBuildAgent/work/ba331bf4546cf0c1/sql/build.xml:62: Execute 
failed: java.io.IOException: Cannot run program "runSqlPlusUnix.sh" (in 
directory 
"/u01/ossint/TeamCityBuildAgent/work/ba331bf4546cf0c1/sql/deployment/r1-0"): 
error=2, No such file or directory
[09:52:34]: Ant output:
    at 
org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:38)
    at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
    at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:416)
    at org.apache.tools.ant.taskdefs.SubAnt.execute(SubAnt.java:289)
    at org.apache.tools.ant.taskdefs.SubAnt.execute(SubAnt.java:208)
    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

I'm having trouble getting a unix script to execute through my ant script. What 
am I doing wrong?


      

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@ant.apache.org
For additional commands, e-mail: user-h...@ant.apache.org

Reply via email to