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?

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 ;

well, since it runs fine from the crontab when i am logged in, i didnt think it was a path or environment problem.

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.

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?

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"