The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Crontab not recognizing the jar files rajuutla Linux 3 05-01-2008 05:27 AM
Crontab not recognizing the jar files rajuutla UNIX for Advanced & Expert Users 0 04-30-2008 03:39 AM
Can crontab execute binary files? Tris UNIX for Dummies Questions & Answers 5 12-07-2006 10:16 AM
recognizing *.* in find amarnath Shell Programming and Scripting 3 07-17-2006 03:24 AM
recognizing * character csejl Shell Programming and Scripting 3 11-15-2005 10:55 PM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-01-2008
Registered User
 

Join Date: Apr 2008
Posts: 5
Stumble this Post!
Question Crontab not recognizing the jar files

Hi All,
I am using crontab which execute a shell script.
In the shell script, I am executing a java program. This Java program requires the jar files.
The cron job file ' cronfile.txt ' contents:

MAILTO="raju_utla@dcis.uohyd.ernet.in"
0-59 * * * * ./cronfile.sh >> /home/rajuutla/FilesForCronJob/logFileForCron.log

The shell script( cronfile.sh ) contents :
#!/bin/bash
#check weather server prog is running or not
test=`ps aux | grep -c java\ PostgresServer`
JAVA_HOME=/opt/SDK/jdk
CLASSPATH=/home/rajuutla/pg74.jdbc3.jar:.
if [ $test -eq 1 ]
then
echo `date`
$JAVA_HOME/bin/java -classpath $CLASSPATH PostgresServer

fi

The java program 'PostgresServer' which i am executing requires the jar file
'pg74.jdbc3.jar' mentioned above.

The problem is, directly running the above shell script with out cron, I am able to get the results. But when I use the crontab to run the java program I am not able to get the results.

What may be the problem? How to resolve this problem? I am unable to find it out.
Please help me.
Thanks to All.
Raju
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 05-01-2008
Cameron's Avatar
Registered User
 

Join Date: Nov 2001
Location: Brisbane, Australia
Posts: 486
Stumble this Post!
Not entirely sure if it will help, but have you tried to export CLASSPATH ...

ie: export CLASSPATH=/home/rajuutla/pg74.jdbc3.jar:.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - -


Later: ...
I do apologise, this is the second night in a row I've logged on and not read posts correctly.
Thank god I'm headed away for the weekend.

If you did a search of the forums, you'd find your answer ... The UNIX Forums - Search Forums

And please stop creating multiple posts.

Last edited by Cameron; 05-01-2008 at 04:35 AM.
Reply With Quote
  #3 (permalink)  
Old 05-01-2008
Technorati Master
 

Join Date: Mar 2005
Location: Large scale systems...
Posts: 2,572
Stumble this Post!
is that a real mail id ? if so, please remove that or provide a fake one

problem with the question - able to run in shell but not in cron is attributed greatly to the environment variables that are needed to run a process which are available via shell automatically or set as a one time configuration. But that might not be the case when run via cron, explicitly provide all the needed environment variables needed to run the process
Reply With Quote
  #4 (permalink)  
Old 05-01-2008
Registered User
 

Join Date: Apr 2008
Posts: 5
Stumble this Post!
Thanks Cameron.
I used export and now I am able to get the results.
Thanks For your Help.


Raju.
Reply With Quote
  #5 (permalink)  
Old 05-01-2008
Cameron's Avatar
Registered User
 

Join Date: Nov 2001
Location: Brisbane, Australia
Posts: 486
Stumble this Post!
Raju,

Please do yourself a favour and read the posts attached to the link I provided.
Whilst the export solution I initially posted has resolved your problem, the kink provided will help you perhaps better identify what you could/should be doing to better avoid the same issue. (IMHO).

Anyways - good to hear you're back on track again.

Cheers,
Cameron
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 04:22 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0