1832269 Members
3493 Online
110041 Solutions
New Discussion

cron issue

 
Duffs
Regular Advisor

cron issue

Hi,

I have got a script that runs successfully from the command line but simply will not run when scheduled on the cron:

10 30 * * * /u/cimrf/scripts/testinvscripts.s

I am not sure if this is related but I am also unable to undate the cron using "crontab -e" and have to opt for vi'ing the /var/spool/cron/crontabs/root file.

Any ideas what the problem could be??

Cheers,
D.
4 REPLIES 4
Pete Randall
Outstanding Contributor

Re: cron issue

Dermot,

Usually, a script that runs fine from the command line but won't run through cron needs to have it's environment variables set in it. Cron provides a very minimal environment and the script needs to explicitly define all it's environment variables and use full path names to all commands.

As far as editing cron, try using crontab -l to create a cron file in your home directory:
"crontab -l > ~/cron."
Then use vi to edit that file and resubmit it with:
"crontab ~/cron."

Pete

Pete
Jean-Luc Oudart
Honored Contributor

Re: cron issue

Hi

1st could you check if you have a cron.allow or cron.deny file in /var/adm/cron ?

Regards
Jean-Luc
fiat lux
Duffs
Regular Advisor

Re: cron issue

Pete,
Apologies for not mentioning it but I have already tried this but still no cigar.

Jean-Luc, I have both cron.allow/deny in that directory also.

D.
Duffs
Regular Advisor

Re: cron issue

Lads, this was so obvious I couldn't see it. The minute and hour filelds were mixed up.