ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From glenn opdycke-hansen <glenn...@gmail.com>
Subject Re: exec unix script not working for me
Date Wed, 22 Jul 2009 01:58:03 GMT
line endings on files from svn:
If the line endings are an issue, you can try a property eol-style: native
for the files that are exported and need the appropriate line endings for
the target system.
See http://svnbook.red-bean.com/en/1.1/ch07s02.html for eol-style details.
--glenn

On Tue, Jul 21, 2009 at 19:46, David Weintraub <qazwart@gmail.com> wrote:

> Inspiration struck!
>
> What are the end-of-line characters on your script? I've seen this
> type of error when the lines in a shell script shell end with
> <CR><LF>. Also make sure that the last line in the shell script ends
> with a <LF>. Some text editors don't put the final <LF> on the end of
> the file.
>
> On Tue, Jul 21, 2009 at 3:09 PM, Amy Davis<nicecoolbreeze@yahoo.com>
> wrote:
> >
> > The unix script file is pulled from SVN into TeamCity's work area. The
> ant script copies it to the location where I want it to run, does a chmod on
> it, and then tries to execute it. The ${sql.deploy.script} argument just
> contains the directory name (bad name, you're right).
> >
> > I tried
> >                <exec executable="${sql.deploy.script}/runSqlPlusUnix.sh"
> dir="${sql.deploy.script}"
> >                    osfamily="unix">
> >                    <arg value="${sql.deploy.script}"/>
> >                </exec>
> >
> > and got
> >
> > [exec] Execute:Java13CommandLauncher: Executing
> '/u01/ossint/TeamCityBuildAgent/work/ba331bf4546cf0c1/sql/deployment/r1-0/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
> "/u01/ossint/TeamCityBuildAgent/work/ba331bf4546cf0c1/sql/deployment/r1-0/runSqlPlusUnix.sh"
> (in directory
> "/u01/ossint/TeamCityBuildAgent/work/ba331bf4546cf0c1/sql/deployment/r1-0"):
> error=2, No such file or directory
> >
> > The runSqlPlusUnix.sh file has a shebang line (contents below):
> >
> > #!/bin/sh
> > # Set up initial variables
> > deployScriptPath=$1
> > # Make sure the file name was supplied
> > if [ ! "${deployScriptPath}" ]; then
> >    echo "The MasterDeployScript.sql file path is required."
> >    exit 1
> > fi
> > ORACLE_HOME=/u00/oracle/oracle/product/10.2.0/db_1
> > export ORACLE_HOME
> > /u00/oracle/oracle/product/10.2.0/db_1/bin/sqlplus -L
> username/password@sidname @${deployScriptPath}/MasterDeployScript.sql >
> ${deployScriptPath}/SQLDeploy.out
> >
> > ----- Original Message ----
> > From: David Weintraub <qazwart@gmail.com>
> > To: Ant Users List <user@ant.apache.org>
> > Sent: Tuesday, July 21, 2009 12:04:48 PM
> > Subject: Re: exec unix script not working for me
> >
> > 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
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> > 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
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message