ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gisbert Amm <...@webde-ag.de>
Subject Re: build dies when called from cron
Date Tue, 19 Jul 2005 07:43:00 GMT
Dave wrote:
> Hi - 
> 
> I have a build system which works fine from the command line, but
> stops mysteriously when I run it from cron.
> 
> The build file structure for my application has a master file at the
> top, which calls targets on submodules, some of which have
> sub-submodules.
> 
> There's a shell script wrapper which calls the master build.xml file,
> and it runs fine from the command line.
> 
> When it runs from cron (after adding the -verbose flag), I see in the
> logs that it get this far in compiling the first of the sub-submodules
> and then exits without any errors:
> 
>     [javac] Files to be compiled:
>     [javac]     /path/to/JavaClass1.java
>                   ...
>     [javac]     /path/to/JavaClass25.java
>       [ant] Exiting /path/to/sub-submodule/build.xml.
>       [ant] Exiting /path/to/submodule/build.xml.
>       [ant] Exiting /path/to/submodule/build.xml.
>   [antcall] Exiting /path/to/master-build.xml.
>   [antcall] Exiting /path/to/master-build.xml.
> 
> When I run the same shell script from the command line, it gets to the
> same place and then keeps going with the jar task which comes after
> the javac task:
> 
>     [javac] Files to be compiled:
>     [javac]     /path/to/JavaClass1.java
>                   ...
>     [javac]     /path/to/JavaClass25.java
> jar:
>      [echo] making jar files for sub-submodule
>     [mkdir] Created dir: /path/to/submodule/lib/classes/META-INF
>      [copy] MANIFEST.MF added as MANIFEST.MF doesn't exist.
> ... and so on until it finishes all the modules.
> 
> The cron job is set up like this:
> 
> 30 2 * * * /path/to/build-and-test.sh > /tmp/cron.log
> 
> Any ideas? Thanks!

It's very likely that the cron unser does not have the same environment 
like you when you start your script at the commandline.

At the moment, you only redirect stdout to your log. You should probably 
  redirect stderr aswell, as there might be errors indeed. Something like

30 2 * * * /path/to/build-and-test.sh > /tmp/cron.log 2>&1

Another possibility is to leave out the redirect and have the whole 
output of cron mailed to you by adding MAILTO=your@address at the 
beginning of the crontab.

BTW: I never setup cronjobs between 2 and 3 in the night because that 
hour is left out when time is changed to summertime in spring.

Regards,
Gisbert Amm

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


Mime
View raw message