[comp.unix.xenix.sco] crontab for ordinary users

ping@cubmol.bio.columbia.edu (Shiping Zhang) (10/16/90)

In order to test if crontab works for, I prepared the follow
script file called test which is chmoded excusable

#!/usr/bin/csh
# the script file
echo test crontab

and created the crontab file with a single line in the format:

min h * * * /wholepath/test

The script is invoked at specified time but aborted at very begining.
I got the following message from the system:

Subject: Output from "cron" command
Status: R

Your "cron" job

/wholepath/test

produced the following output:

TERM: Undefined variable.


I tried the following:
min h * * * export TERM; /wholepath/test
min h * * * set TERM; export TERM; /wholepath/test
min h * * * set TERM termname; export TERM; /wholepath/test
etc...
But non of them worked.
However, if it was invoked in the root crontab, it worked fine.
Can anyone point out to me what is the problem?
Thanks.

-ping

tin@smsc.sony.com (Tin Le) (10/17/90)

In article <1990Oct15.181918.8325@cubmol.bio.columbia.edu> ping@cubmol.bio.columbia.edu (Shiping Zhang) writes:
>In order to test if crontab works for, I prepared the follow
>script file called test which is chmoded excusable
>
>#!/usr/bin/csh
># the script file
>echo test crontab
>
>and created the crontab file with a single line in the format:
>
>min h * * * /wholepath/test
>
>The script is invoked at specified time but aborted at very begining.
>I got the following message from the system:
>
>Subject: Output from "cron" command
>Status: R
>
>Your "cron" job
>
>/wholepath/test
>
>produced the following output:
>
>TERM: Undefined variable.
>
>
>I tried the following:
>min h * * * export TERM; /wholepath/test
>min h * * * set TERM; export TERM; /wholepath/test
>min h * * * set TERM termname; export TERM; /wholepath/test
>etc...
>But non of them worked.
>However, if it was invoked in the root crontab, it worked fine.
>Can anyone point out to me what is the problem?
>Thanks.
>
>-ping

This is because cron is executing your command (shell script or not) under
your uid.  It will do something similar to 'su - your_uid' to also pick
up your environment definitions and then execute your command(s).  I'd
check your .cshrc/.login (if you are using csh) or .profile (if sh).

When cron is executing something like this, there is no controlling terminal.
Something in your .cshrc/.login/.profile is doing I/O to the terminal and
I think that is what cron is complaining about.  Check for echo's, read's,
etc.

-- Tin


-- 
.----------------------------------------------------------------------
. Tin Le                    Work Internet: tin@smsc.Sony.COM
. Sony Microsystems              UUCP: {uunet,mips}!sonyusa!tin
. Work: (408) 944-4157      Home Internet: tin@szebra.UUCP

jms@tardis.Tymnet.COM (Joe Smith) (10/20/90)

In article <1990Oct15.181918.8325@cubmol.bio.columbia.edu> ping@cubmol.bio.col
umbia.edu (Shiping Zhang) writes:
>Subject: Output from "cron" command
>Your "cron" job "/wholepath/test" produced the following output:
>TERM: Undefined variable.

One common error is when the unsuspecting user puts something like
	tset -e^? -k^U -n -s -m dialup:?vt100 -m network:?vt100 $TERM
in their .cshrc file, instead of their .login file where it belongs.

Check to see of your .cshrc file references $TERM anywhere.  If you can't
move that command to .login, you can program around it.  For instance:
  set path=(.. a bunch of stuff ..)
  if ($?USER == 0 || $?prompt == 0) exit
  set notify mail=(15 /usr/spool/mail/$USER) history=500 savehist=500
  alias tset 'eval `\tset -s !*`' # This redefines TERMCAP
The first line is executed whenever csh is invoked for any reason, the
third and fourth only when a human being is connected to it (such as login,
rlogin, or a Sunview window).
-- 
Joe Smith (408)922-6220 | SMTP: jms@tardis.tymnet.com or jms@gemini.tymnet.com
BT Tymnet Tech Services | UUCP: ...!{ames,pyramid}!oliveb!tymix!tardis!jms
PO Box 49019, MS-C41    | BIX: smithjoe | 12 PDP-10s still running! "POPJ P,"
San Jose, CA 95161-9019 | humorous dislaimer: "My Amiga 3000 speaks for me."