[net.unix] Solution to cron+script+syslog problem

rlw@well.UUCP (Bob Weissman) (02/18/86)

Thanks to all who responded to my message about being unable to do
a syslog from a C shell script under su under cron.  Since I got so
many reponses (some of which were close, but not entirely right),
I thought I'd post the solution (also thereby acknowledging that I
now have the answer & y'all can stop helping now).

The problem is the lack of environment under cron.  Little goodies
you expect to be set, such as $USER and $PATH don't exist.  In fact
the entire environment, as printed out by printenv under cron is:
HOME=/

So the solution was to check for unset variables and set the ones you
need.

Thanks again to all respondents.
-- Bob Weissman
   G.WEISSMAN@SU-SCORE.ARPA
   ..!well.rlw

dick@ucsfcca.UUCP (Dick Karpinski) (02/21/86)

In article <671@well.UUCP> rlw@well.UUCP (Bob Weissman) writes:
>
>The problem is the lack of environment under cron.  Little goodies
>you expect to be set, such as $USER and $PATH don't exist.  In fact
>the entire environment, as printed out by printenv under cron is:
>HOME=/
>
>So the solution was to check for unset variables and set the ones you
>need.
>
If you are running 4.2 BSD, doesn't rlogin to this machine provide
all the environment just like the one you use while developing?
That is, if "rlogin ucsfcca" is the first executable line of my
C-shell script and "logout" is the last, I think things will work
much as they would during development of the shellscript.  Right?

Dick
-- 
Dick Karpinski    Manager of Unix Services, UCSF Computer Center
UUCP: ...!ucbvax!ucsfcgl!cca.ucsf!dick   (415) 666-4529 (12-7)
BITNET: dick@ucsfcca   Compuserve: 70215,1277  Telemail: RKarpinski
USPS: U-76 UCSF, San Francisco, CA 94143