1844070 Members
3026 Online
110227 Solutions
New Discussion

Crontab not working

 
susee
Advisor

Crontab not working

Hi everybody

we are facing some problems with crontab
we have scheduled a dba maitainence scripts at various timings in the crontab but it fails to execute ,even the user has access to run cron jobs we are able to login as particular user , and all other users cron jobs are working,

kindly suggest us to help me getting this sorted out
7 REPLIES 7
Sundar_7
Honored Contributor

Re: Crontab not working

Make sure cron daemon is running. What do you see in the /var/adm/cron/log file ?
Learn What to do ,How to do and more importantly When to do ?
Chan 007
Honored Contributor

Re: Crontab not working

Have you tried to edit by crontab -e from that user. if not better start & start the crond daemon.

Check the permissions to that file and ownership

Chan
A. Clay Stephenson
Acclaimed Contributor

Re: Crontab not working

First of all, make sure that the user is not in /var/adm/cron/cron.deny and is in the cron.allow file.

Secondly, check /var/adm/cron/log for errors.

If it ain't broke, I can fix that.
Pete Randall
Outstanding Contributor

Re: Crontab not working

Check the cron log file. You should see entries similar to these which indicate the start and end of the job:

> CMD: /apps/hols/bin/wb/checkweb.ksh
> informix 2340 c Fri Jan 27 05:59:00 EST 2006
< informix 2340 c Fri Jan 27 05:59:01 EST 2006

You may also see an error message if the job started and failed. The most common error with cron jobs is the lack of environment. You have to set environment variables within the job and you need to specify full path names to all command used.


Pete

Pete
A. Clay Stephenson
Acclaimed Contributor

Re: Crontab not working

You should login as this user and run crontab -l. That will tell you if his crontab entries are actually valid and available to cron.

I suspect that the real problem is that the script is actually being started but is failing because it is missing critical environment variables (e.g. PATH) when run under cron. Cron has an intentionally sparse environemnt and it is necessary to explicitly set PATH and other variable in the script itself.
If it ain't broke, I can fix that.
DCE
Honored Contributor

Re: Crontab not working



does the user have the right environment variables set? The user may need to do a su - in the cronjob in order to get the variables for the db maintenance to ork - or you may need to put all the variables in the users .profile.
Ivan Ferreira
Honored Contributor

Re: Crontab not working

Check that user's mail. Errors in cron processing normally are sent by mail to the user's mailbox.
Por que hacerlo dificil si es posible hacerlo facil? - Why do it the hard way, when you can do it the easy way?