Script Works, But Not with CRON
Tim Fischer
tim.fischer at trinitytransport.com
Wed May 5 10:13:50 PDT 2004
> I think maybe you and Keith Weatherhead have detected my
> oversight. PFDSK is set to "/u" in the environment for all
> regular users, but 'cron' isn't a regular user.
>
> Its absence in the script would explain why it works from the
> command line, but not when run by 'cron'- that being the
> significant difference in the environment in which it runs
> under those two conditions.
>
> I'll set it in the script and see what happens tonight.
>
> Thanks all . . .
>
> Bob (kicking himself in the head over that oversight)
I ran into a similar situation recently. By simply throwing an environment
setting script into cron (before each job) it takes care of it in one place
that is easily maintainable. For instance:
20 5 * * 1-5 sh -c ". /u/cron.env; /u/job1"
Basically, the cron.env is just the cron environment. It's kind of tedious
to add this to all appropriate cron jobs (we have a ton of jobs that run
through cron) but once it's in place, it's very easy to maintain.
-Tim
More information about the Filepro-list
mailing list