[comp.unix.admin] crontab for ordinary users

fpb@ittc.wec.com (Frank P. Bresz) (10/21/90)

In article <1294@tardis.Tymnet.COM> jms@tardis.Tymnet.COM (Joe Smith) writes:
>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).

	My opinion here is that nothing is needed in .cshrc to give stuff
to a shell that isn't interactive, they should inherit all they need.  I
have taken to giving the following .cshrc to new users.

# skip remaining setup if not an interactive shell

if ($?USER == 0 || $?prompt == 0) exit

set noclobber

# aliases for all shells

alias cd            'cd \!*;echo $cwd'
alias cp            'cp -i'
alias mv            'mv -i'
alias rm            'rm -i'
alias pwd           'echo $cwd'

# settings  for interactive shells

set history=40
set ignoreeof


And the following .login file.

# set up search path

setenv FMHOME /usr/local/frame
set lpath = ($FMHOME/bin )  #  add directories for local commands
set path = (. ~ ~/bin $lpath /usr/local/bin /usr/ucb /usr/bin /usr/etc)


if ("`tty`" != "/dev/console") exit
echo -n "SunView? (Control-C to interrupt) "
sleep 2
sunview


	PATH IMHO is something that should be set at login time only.  It
should be inherited by all subsequent shells including sunview, xterminals
etc.  I had some problems because the .cshrc provided by sun set the PATH
if it was an interactive shell.  When people tried running OpenWindows the
sript hacked a few things onto the PATH (it needed to).  But the only thing
that ended up having this PATH was the window manager since each subsequent
shell started redefined the PATH to what it wanted.  Basically what I have
moved to the .login file.  Some other people decide to use $path everywhere
i.e.. set path = ( $path /usr/local/bin ).  I needn't tell you that PATH
quickly got VERY long.

	Now for the question (flame request) of the day.  Do people in
general agree with me that .cshrc ought to not touch the path variable or
the PATH env and just inherit it?
--
| ()  ()  () | Frank P. Bresz   | Westinghouse Electric Corporation
|  \  /\  /  | fpb@ittc.wec.com | ITTC Simulators Department
|   \/  \/   | uunet!ittc!fpb   | Those who can, do. Those who can't, simulate.
| ---------- | (412)733-6749    | My opinions are mine, WEC don't want 'em.