Computing.Net > Forums > Linux > crontab problem

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

crontab problem

Reply to Message Icon

Name: karmaker
Date: May 21, 2007 at 20:50:19 Pacific
OS: linux
CPU/Ram: 222
Product: linux
Comment:

Hi,


I am new to UNIX Env.I have a batch file which has the following lines.

#!/bin/sh
PATH=$PATH\:/var/shine/scripts/ListUsersJob ; export PATH
/usr/java/j2sdk1.4.2_10/bin/javac -classpath activation.jar:mail.jar:. ListUsersJob.java
/usr/java/j2sdk1.4.2_10/bin/java -cp activation.jar:jtds-1.2.jar:mail.jar:. ListUsersJob


The above batch job runs well when i try to run it in the same directory (ie.,

/var/shine/scripts/ListUsersJob), but when i set this batch job as a cron, it is giving me the

following error when i checked my mail in UNIX env.

mail content _______________________________________________________________

To: jboss@localhost.localdomain
Subject: Cron <> /var/shine/scripts/ListUsersJob/runJob.sh
X-Cron-Env: <SHELL=/bin/sh>
X-Cron-Env: <HOME=/opt/jboss-4.0.3SP1>
X-Cron-Env: <PATH=/usr/bin:/bin>
X-Cron-Env: <LOGNAME=jboss>
X-Cron-Env: <USER=jboss>

error: cannot read: ListUsersJob.java
1 error
Exception in thread "main" java.lang.NoClassDefFoundError: ListUsersJob

______________________________________________________________________________


The following is my crontab setting

[jboss@msapp01s ~]$ crontab -l
05 11 * * * /var/shine/scripts/ListUsersJob/runJob.sh


I would appreciate your help in solving this pr




Sponsored Link
Ads by Google

Response Number 1
Name: thepubba1
Date: May 22, 2007 at 10:58:11 Pacific
Reply:

Export your java variables (JAVAHOME for example) in your script. Most likely, these variables are set in your login shell via the .profile, but they are not set when the job is executed from the crontab.


0

Response Number 2
Name: KenJackson
Date: May 25, 2007 at 04:45:20 Pacific
Reply:

The current directory for cron is not your directory, so put this line in runJob.sh before you call javac or java:

cd /var/shine/scripts/ListUsersJob


Why I prefer GNU/Linux


0

Response Number 3
Name: thepubba1
Date: May 30, 2007 at 06:32:27 Pacific
Reply:

Ken:

The java error indicates the process is not finding the java class files. It is an environment issue, not a PATH issue. If JAVAHOME is not set, the " Exception in thread "main" java.lang.NoClassDefFoundError: ListUsersJob" error occurs. There are also other java variables that might need to be set. I'll bet that they are set in his .profile, which is why his process executes from a command line.


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More


VMware Linux fedora 5 Printing in Linux



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Linux Forum Home


Sponsored links

Ads by Google


Results for: crontab problem

Crontab Problem www.computing.net/answers/linux/crontab-problem/29886.html

Crontab problem www.computing.net/answers/linux/crontab-problem/23278.html

Another Cable Modem Problem www.computing.net/answers/linux/another-cable-modem-problem/3059.html