![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| 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 !! |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| problem with crontab | cleansing_flame | UNIX for Dummies Questions & Answers | 1 | 01-29-2008 05:02 PM |
| Problem with crontab | cleansing_flame | UNIX for Dummies Questions & Answers | 3 | 01-14-2008 01:03 PM |
| Crontab problem | jess_t03 | AIX | 2 | 01-03-2008 04:29 AM |
| Problem with Crontab | Zak | UNIX for Dummies Questions & Answers | 2 | 12-20-2005 02:44 AM |
| crontab problem | DebianJ | UNIX for Advanced & Expert Users | 10 | 06-04-2005 12:36 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
#1
|
|||
|
|||
|
Problem with Crontab
I have a problem with crontab. I made a class file name Mailer.class. When I run it at command line like this:
$ java Mailer It runs very well and I got the email. But If I put it in a crontab line like this: 30 11 * * * java Mailer It doesn't work. Every time the cron job finished, when I type something at command line, I got the "You have mail" sentence. Please help me. I appreciate any help, comment Thanks |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
You have probably lost your CLASSPATH environment variable using cron. Your .profile isn't getting launched in the non-inteactive shell that cron runs. Use -classpath and/or ensure you are setting up your environment using a shell script wrapper.
The mail message you are getting is no doubt related to the failed cron job. |
|
#3
|
|||
|
|||
|
Thank you very much for a quick reply.
I have CLASSPATH environment variable in my .profile. And that is a long string. Do you have any link so I can learn how to set up environment using a shell script wrapper? Or can you give me some note about that? I'm new to Unix. So please don't laugh at me... Thanks again |
|
#4
|
|||
|
|||
|
In the simplest form, create a shell script file called Mailer.sh:
Code:
#! /usr/bin/ksh # Source your .profile parameters . /home/youruserid/.profile # or export CLASSPATH=yourreallylogclasspath # add/modify more variables that you need java Mailer Code:
chmod 755 Mailer.sh Code:
30 11 * * * /someUnixPathToYourScript/Mailer.sh |
|
#6
|
|||
|
|||
|
Hi tmarikle,
Thank you very much for your help. It works very well!!! I am really appreciate your help. Quang |
|||
| Google The UNIX and Linux Forums |