ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Weintraub <qazw...@gmail.com>
Subject Re: exec unix script not working for me
Date Tue, 21 Jul 2009 17:04:48 GMT
If you put a Shebang in your shell script, and you have the executable
bit on in the mode, you don't have to specify the shell.

<exec executable="runSsqlPlusUnix.sh" dir="${sql.deploy.script}/"
   osfamily="unix">
   <arg line="${sql.deploy.script}"/>
</exec>


HOWEVER, if you do use the shell, you need to put the full directory
name where your script can be found:

<exec executable="bash" dir="${sql.deploy.script}/"
   osfamily="unix">
   <arg line="${runSqlPlusUnix.dir}/runSqlPlusUnix.sh ${sql.deploy.script}"/>
</exec>

By the way, is ${sql.deploy.script} a directory or script? You're
using it as both. Maybe this is what you need:

<dirname property="sql.deploy.script.dir"
   file="${sql.deploy.script}"/>
<exec executable="bash" dir="${sql.deploy.script}/"
   osfamily="unix">
   <arg line="${runSqlPlusUnix.dir}/runSqlPlusUnix.sh
${sql.deploy.script.dir}"/>
</exec>

On Tue, Jul 21, 2009 at 10:21 AM, Amy Davis<nicecoolbreeze@yahoo.com> wrote:
>
> 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-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>



-- 
David Weintraub
qazwart@gmail.com

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


Mime
View raw message