ant not being executed as cron job


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting ant not being executed as cron job
# 1  
Old 11-11-2004
ant not being executed as cron job

i have a script that uses an ant build.xml and its targets to pull a project from a cvs server, attempt to build the project, and then email me the results. When I run the script (either @ CLI or as a cron job) while I am logged in, everything works fine. However, if the script is set up to run as an automatic cron job and I am NOT logged in, none of the ant targets execute. Other commands are run, i.e. the mail command, but none of the ant tasks do. Is this a permissions problem, do i need to chmod somehow or su?
# 2  
Old 11-11-2004
I guess u had put all of the commands in a script and schedule that script as crontab ;

when u do that ... are u sure that .. the env is set for "ant" ??
meaning .. path to ant ... javac ... etc ??

PATH and CLASSPATH to whatever is needed to execute those targets in build.

If possible .. export all those needed in that script itself and run it ... ;

In order to test it ... schedule the cron for every hour or less than that ; u wull not waste much time if u go this direction ;
# 3  
Old 11-11-2004
well, since it runs fine from the crontab when i am logged in, i didnt think it was a path or environment problem.
# 4  
Old 11-11-2004
Is it running under your id? If so, do you have nfs mounted home directories? If so, when you are logged in the cron job can get to everything. When you are not logged in, your home directory isn't there (although this is a leap since I would think it would get mounted even out of cron - but worth looking into).

further testing: I tried it on a Solaris server and automount of nfs does seem to work from cron when I'm not logged in - so I guess this won't help you much.

Last edited by RTM; 11-11-2004 at 05:06 PM..
# 5  
Old 11-12-2004
Is there a way i can simulate a login in my script then, using su or sudo? I'm relatively new to this and dont know the usage of these two commands well. is it possible they could help?
# 6  
Old 11-12-2004
I'm not sure that will solve your prblem ;
But to run the script as a "user"

U can try some thing like this ...


su user "-c script.sh"
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to detect and fix why crontab job is not executed?

I have set several cron jobs. I recently added a new cron job that copies a file of last day from another server and is executed each day (for example at 04:00 am) but when I check next day the file hasn't been copied. I'm working in GNU/Linux CentOS (2.6.32) system. The files that I need to... (23 Replies)
Discussion started by: Ophiuchus
23 Replies

2. UNIX for Beginners Questions & Answers

/etc/cron.daily script is not being executed

Hi All I have created a file in /etc/cron.daily on redhat linux 7.3 version host called applicationscript cat applictaionscript #!/bin/bash /prod/data/routine.sh cat /prod/data/routine.sh #!/bin/bash #details regular=/prod/data/jboss/logs backup=/prod/data/logs #echo "Moving logs"... (3 Replies)
Discussion started by: anil529
3 Replies

3. Shell Programming and Scripting

Script executed by Cron or commandline

Hello all, I have a question regarding the difference betwen cron and command line. What I would like to do is to print a statement into a logfile if a script has been executed from cron or from command line. It should be as: #!/bin/bash if <Check if this script has been... (3 Replies)
Discussion started by: API
3 Replies

4. Shell Programming and Scripting

Cron job - Need to run Cron every quarter at particular time

Hi, 1) If some job supposed to run on 1st of every month at 7 AM In cron job when we have a blackout on the 1st ( i.e when 1st falls on a sunday ) how can we make the job run the next business day? 2) How can we run a job on 25th of every quarter 7 AM(jan,apr,jul,oct) And if 25th... (5 Replies)
Discussion started by: System Admin 77
5 Replies

5. UNIX for Dummies Questions & Answers

Cron job executed at wrong time

Dear *nix users. I'm on Mac OS 10.6 / Terminal and try to use crontab to schedule two scripts every 30 minutes and every 41 minutes. I followed the man instructions and created / installed a crontab file for the current user:crontab -e with the following content */30 * * * *... (4 Replies)
Discussion started by: moxnos
4 Replies

6. Shell Programming and Scripting

crontab job not executed with variables

Hi, I am trying to execute a script (for once) during the booting time in Ubuntu system. However, the result is only showing the strings without without the variables. Here is the script: MgrIp=$(ec2-describe-instances --filter tag:Name=Mgr --filter instance-state-name=running | egrep... (4 Replies)
Discussion started by: turki_00
4 Replies

7. AIX

Script not getting executed via cron but executes when executed manually.

Hi Script not getting executed via cron but executes successfully when executed manually. Please assist cbspsap01(appuser) /app/scripts > cat restart.sh #!/bin/ksh cd /app/bin date >>logfile.out echo "Restart has been started....." >>logfile.out date >>logfile.out initfnsw -y restart... (3 Replies)
Discussion started by: samsungsamsung
3 Replies

8. UNIX for Advanced & Expert Users

Functionality of ant build and ant deploy unix commands

I have made some code changes in the corresponding java file for date formatting purpose so that it supports upgraded sybase version from 12.6 to 12.7 and have build the code and deployed using the following UNIX commands. ant build ant deploy. "ant build" executes the build.xml which is... (1 Reply)
Discussion started by: vmpcit
1 Replies

9. UNIX and Linux Applications

Log files to view job executed in Autosys -- Help ASAP

Hi all, I really need your help ASAP on this. Below is the description of my problem and a sketch of Autosys Job Activity Console ++++++++++++++++++++++++++++++++ File View Options +++++++++++++++++++++++++++++++ Job Name Description Status Command Machine... (1 Reply)
Discussion started by: sakal_woman
1 Replies

10. Shell Programming and Scripting

Script errors out only when its executed via job

I wrote a script to shutdown the oracle database. The script works fine when I manually run the script. However, when i schedule a job, i get the following error. Shutting Down cmismart .................... ORA-01034: ORACLE not available ORA-27101: shared memory realm does not exist SVR4... (6 Replies)
Discussion started by: mrx1350
6 Replies
Login or Register to Ask a Question