Return-Path: Delivered-To: apmail-ant-user-archive@www.apache.org Received: (qmail 93223 invoked from network); 20 Oct 2007 18:41:54 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 20 Oct 2007 18:41:54 -0000 Received: (qmail 71948 invoked by uid 500); 20 Oct 2007 18:41:33 -0000 Delivered-To: apmail-ant-user-archive@ant.apache.org Received: (qmail 71919 invoked by uid 500); 20 Oct 2007 18:41:33 -0000 Mailing-List: contact user-help@ant.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Ant Users List" Reply-To: "Ant Users List" Delivered-To: mailing list user@ant.apache.org Received: (qmail 71908 invoked by uid 99); 20 Oct 2007 18:41:33 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 20 Oct 2007 11:41:33 -0700 X-ASF-Spam-Status: No, hits=2.0 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of arun.george.1981@gmail.com designates 66.249.82.230 as permitted sender) Received: from [66.249.82.230] (HELO wx-out-0506.google.com) (66.249.82.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 20 Oct 2007 18:41:35 +0000 Received: by wx-out-0506.google.com with SMTP id h30so1687489wxd for ; Sat, 20 Oct 2007 11:41:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; bh=S7HUUgr2MulSfrtWcRos2HB2NTJ0cYyUYMeWtPojs8Y=; b=fJL5ryOpoRqdyjOqBE/jDP9LdqJ/SjGZdm9UsOWQKw5j4tFmU1iAOLGY/ZVRPGqkb09R83XWWBe7QSBYpZgk2pYlj9FEjQtitB7vxDUoSTAqoK6xYCcxqKbXmWzQrL6HnUdDLaD279WrYGlC5lSgR9QApeTnR8/EXr2NwEiZxmA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; b=HbdV5W3AbQFBD+oHGO0Vr7sr0tJdty9XXJOuMxzBRLWDOBBwuoA8pP1qR2jJRnEWhjXo+YkfsZkPFxZYlqY5pqTWCZAu7g8YZmMXYSu23bNjOhO9hMsOARsgkciH3oReqJkYX/RKWCpU6QyHv/N4WOyR5zdmfg4AudRUpePLuo0= Received: by 10.70.16.6 with SMTP id 6mr5368927wxp.1192905673763; Sat, 20 Oct 2007 11:41:13 -0700 (PDT) Received: by 10.70.74.8 with HTTP; Sat, 20 Oct 2007 11:41:13 -0700 (PDT) Message-ID: Date: Sun, 21 Oct 2007 00:11:13 +0530 From: Arun To: "Ant Users List" Subject: Re: Passing environment to cron In-Reply-To: <471A388D.3000101@mindspring.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_12727_33353839.1192905673755" References: <471A289B.60009@mindspring.com> <471A2A76.6000000@mindspring.com> <471A388D.3000101@mindspring.com> X-Virus-Checked: Checked by ClamAV on apache.org ------=_Part_12727_33353839.1192905673755 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Scot, Ok, yes a crontab calls the perl script and executes the ant script. The line `ant -logfile build.log` executes the ant. But I sourced the bashrc in perl. But still the same. Any ideas.? On 10/20/07, Scot P. Floess wrote: > > Arun: > > Sorry I don't know any Perl :( > > So what is the problem exactly? You are trying to run this from Perl or > a crontab that calls a Perl script who executes your Ant script? > > I'm not following the problem :( Sorry about that... > > Arun wrote: > > Scot, > > Thanks a lot for the reply. You are correct. I was not sourcing it . But > > When I echo the variable CATALINA_HOME from perl script it is an empty > > string causing the same effect. > > Take a peek at my perl script which runs as cron task. > > This script updates from sourceforge cvs and redeploys to tomcat using > ant. > > > > #!/usr/bin/perl > > my $home="/home/build"; > > my $tomcathome="/usr/local/bin/apache-tomcat-6.0.13"; > > my $TRUE='true'; > > my $checkoutcvs=$ARGV[0]; > > my $clean=$ARGV[1]; > > chdir '/home/build/mobchannel'; > > print "Usage: ./autobuild [checkout] [clean]\n"; > > print "The values for checkout and clean can be true or false or nothing > for > > default\n"; > > print "Default values are checkout=false and clean=false\n"; > > print "checkout ? $checkoutcvs \n"; > > `. /root/.bashrc`; > > print "CATALINA_HOME = ${CATALINA_HOME}"; > > if($clean eq $TRUE) > > { > > `rm -rf mobchannelWEB`; > > } > > else > > { > > $checkoutcvs='false'; > > } > > > > if($checkoutcvs eq $TRUE) > > { > > print "Checking out from CVS\n"; > > `cvs -d ":extssh:arungeorge1981\@mobchannel.cvs.sourceforge.net > :/cvsroot/mobchannel" > > co mobchannelWEB`; > > } > > else > > { > > $clean='false'; > > } > > > > print "Changed dir to mobchannelWEB\n\n"; > > chdir 'mobchannelWEB'; > > print "Starting Build...............\n"; > > `rm -rf build.log`; > > `ant -logfile build.log `; > > > > my $failed=`grep "BUILD FAILED" build.log`; > > if($failed) > > { > > print "BUILD FAILED"; > > my $tlog=`tail -1000 build.log`; > > print "$tlog "; > > } > > else > > { > > print "Stopping Server , stand by...............\n"; > > `catalina stop`; > > `pkill -9 java`; > > print "Server stopped ...............\n\n\n"; > > `rm -rf $tomcathome/webapps/mobchannelWEB`; > > print "Removing context MobchannelWEB ...............\n"; > > #`rm -rf $home/temp`; > > `mkdir $tomcathome/webapps/mobchannelWEB`; > > #`mkdir $home/temp`; > > print "Deploying Context mobchannelWEB ...............\n"; > > `cp -r WebRoot/* $tomcathome/webapps/mobchannelWEB`; > > #`cp -r WebRoot/* $home/temp`; > > chdir '/usr/local/bin/apache-tomcat-6.0.13/webapps/mobchannelWEB/'; > > `find . -type f | xargs grep -l ' > mobchannel.database.user.password=fiddle' > > | xargs sed -i '' -e > > > 's/mobchannel.database.user.password=fiddle/mobchannel.database.user.password=mobchannel/g'`; > > print "Starting Server ...............\n"; > > `catalina start`; > > } > > print " Sending mail.....\n"; > > chdir '/home/build/mobchannel/mobchannelWEB'; > > `/home/build/mobchannel/sendMail.pl $checkoutcvs $clean`; > > > > > > > > > > > > > > > > > > On 10/20/07, Scot P. Floess wrote: > > > >> Sorry, by script I mean something that resembles the cron entry I > >> listed... > >> > >> Scot P. Floess wrote: > >> > >>> Arun: > >>> > >>> I believe your problem is related to the way in which cron is > >>> running. I don't believe your .bashrc is being sourced. You may need > >>> to either write a script to kick off your ant tasks or perhaps make > >>> the cron entry resemble something like > >>> > >>> . ~/.bashrc ; ant -f [dir to build.xml]/build.xml [whatever tasks you > >>> call] > >>> > >>> Please note the preceeding dot in > >>> > >>> . ~/.bashrc > >>> > >>> This will source your bashrc and apply whatever is set there to the > >>> currently running shell... > >>> > >>> Arun wrote: > >>> > >>>> Hi, > >>>> > >>>> have a problem running ant script as a cronjob. The cron tells > >>>> > >>>> BUILD FAILED > >>>> /home/build/mobchannel/mobchannelWEB/build.xml:230: > >>>> /home/build/mobchannel/mobchannelWEB/${env.CATALINA_HOME}/bin not > >>>> > >> found. > >> > >>>> But when I directly execute the build.xml using ant this error does > not > >>>> occur. > >>>> > >>>> > >>>> > >>>> > >>>> > >>>> > >>>> > >>>> > >>>> > >>>> > >>>> >>>> name="jasper2"> > >>>> > >>>> >>>> /> > >>>> > >>>> > >>>> My CATALIN_HOME points to correctly and so does my JAVA_HOME. > >>>> > >>>> The ${tomcat.home}/bin is getting expanded to path > >>>> /home/build/mobchannel/mobchannelWEB/${env.CATALINA_HOME}/bin . > >>>> > >>>> When it should have been /usr/local/bin/apache-tomcat-6.0.13/bin. > >>>> > >>>> Why does my ant script do this when run from a cronjob using perl > >>>> script. > >>>> > >>>> Obviously the env property should be empty. I am calling ant -logfile > >>>> build.log from my perl script. And I am including the perlscript as a > >>>> cron > >>>> job. > >>>> > >>>> How can I pass the environment to ant. I have my CATALIN_HOME entry > in > >>>> ~/.bashrc. And When I echo in console I can see that too. > >>>> > >>>> > >>>> > >>>> > >> -- > >> Scot P. Floess > >> 27 Lake Royale > >> Louisburg, NC 27549 > >> > >> 252-478-8087 (Home) > >> 919-754-4592 (Work) > >> > >> Chief Architect JPlate http://sourceforge.net/projects/jplate > >> Chief Architect JavaPIM http://sourceforge.net/projects/javapim > >> > >> > >> --------------------------------------------------------------------- > >> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org > >> For additional commands, e-mail: user-help@ant.apache.org > >> > >> > >> > > > > > > > > -- > Scot P. Floess > 27 Lake Royale > Louisburg, NC 27549 > > 252-478-8087 (Home) > 919-754-4592 (Work) > > Chief Architect JPlate http://sourceforge.net/projects/jplate > Chief Architect JavaPIM http://sourceforge.net/projects/javapim > > -- Thanks Arun George ------=_Part_12727_33353839.1192905673755--