Hi I am trying to call a java standalone through the crontab. I have written a standalone java program and deployed ths same in /bin. I have written a standalone.sh file and i am calling the java file in that.
standalone.sh(The contents are) java Update
It works fine if I directly run the file from linux like ./standalone.sh
In my crontab i am calling the standalone.sh as
*/10 8-19 * * Mon-Fri /bin/standalone.sh , which should run every 10 minutes from Monday to Friday. In this same way I have written a servlet(in place of standalone) which works fine.
cron jobs don't have your full complement of environment variables available because they're not run in a login shell. Just make sure the standalone.sh includes everything it needs to run, and things should work fine -- i.e., path to Java, classpath, LD_LIBRARY_PATH, or whatever else you might need.
You can setup a common file with all the environment parameters you need and then source this file from within your shell script to properly set the environment. This is a neat and tidy way of keeping the environment definition in one place and works well if you need to have more than one program running with the same environment variables.