|
|
Question : How to run java program from cron
|
|
I thought it would be just like anything else, but for some reason my java program returns a non-zero return code when run from cron. When run from command line it works fine.
This is my code that excutes the java program.
JAVADIR=/usr/java/jdk1.5.0_06/bin
CLASSPATH=/test/hstaload:/opt/jboss-4.0.3SP1/server/default/lib/postgresql-8.1-404.jdbc3.jar:/test/hstaload/alturalibCompile.jar:/test/hstaload/HstaLoad.jar export CLASSPATH export JAVADIR
$JAVADIR/java HstaLoadCeridianPay >>$JOBLOG CONDCODE=$?
|
Answer : How to run java program from cron
|
|
What do you get in log file? Any information to why it failed? It has to be envirnment related. To make sure add your .profile/.bashrc/.cshrc (or whatever is your shell startup script) to this script. If the program works fine in cron it is env related.
. /home/user1/.profile JAVADIR=/usr/java/jdk1.5.0_06/bin
You could either leave the profile there in your script or add its content one by one until you find out which one makes your program run fine from cron.
|
|
|
|