LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (http://www.linuxquestions.org/questions/linux-software-2/)
-   -   cron job (http://www.linuxquestions.org/questions/linux-software-2/cron-job-494980/)

somsahi 10-23-2006 08:17 PM

cron job
 
Hi i have script
#!/bin/sh
cd /home/wasadmin/jar /usr/java/j2sdk1.4.2_12/bin/java -jar /home/wasadmin/jar/A.jar
echo hello

but in mail I am getting nothing except hello.
and jar is not working as expected from this script but from command line (/usr/java/j2sdk1.4.2_12/bin/java -jar /home/wasadmin/jar/A.jar)its working.
I am running this command from /home/wasadmin/jar directory


regards

baikonur 10-24-2006 01:24 AM

#!/bin/sh
cd /home/wasadmin/jar; /usr/java/j2sdk1.4.2_12/bin/java -jar /home/wasadmin/jar/A.jar
echo hello

timmeke 10-24-2006 05:40 AM

A few tips:
1. Try putting separate commands on separate lines, or, as suggested, put ";" to separate them.
2. Try running the script from command line before running it from cron.
3. When pasting code & commands on this forum, try enclosing them in tags. That makes it
much more readable.
4. You may need to set some environment variables (ie JAVA_HOME) for this script to work properly. You can do this at the top of your crontab settings, or by "source"ing your .bashrc (or other) file directly in the script.


All times are GMT -5. The time now is 02:38 PM.