Fixed *annoying* error with the weekly files. Do you get these whenver

/etc/weekly is run?

Rebuilding locate database: stty: stdin isn't a terminal TERM: Undefined
variable.

'su' apparently runs in root's environment before doing a seteuid(), so
it reads root's .cshrc.  The problem lies in the fact that $prompt is
*always* set by the time the command is executed, so you can't protect
your interactive commands from the non-interactive commands by the
normal:

if ($?prompt) then
   # interactive stuff here
endif

Set the -f flag (su -fm) which causes it not to read root's .cshrc file,
since there should be no reason to do so for these scripts since
/etc/crontab sets up all of the necessary environment.
This commit is contained in:
nate 1996-05-18 20:30:04 +00:00
parent 48c7921229
commit 44df49b453

View File

@ -1,7 +1,7 @@
#!/bin/sh -
#
# @(#)weekly 5.14 (Berkeley) 6/23/91
# $Id: weekly,v 1.14 1996/05/12 21:10:34 wosch Exp $
# $Id: weekly,v 1.15 1996/05/13 22:05:10 wosch Exp $
PATH=/bin:/sbin:/usr/sbin:/usr/bin:/usr/libexec
export PATH
@ -46,7 +46,7 @@ echo ""
echo "Rebuilding locate database:"
locdb=/var/db/locate.database
touch ${locdb}; chown nobody ${locdb}; chmod 644 ${locdb}
echo /usr/libexec/locate.updatedb | nice -5 su -m nobody 2>&1 |\
echo /usr/libexec/locate.updatedb | nice -5 su -fm nobody 2>&1 |\
fgrep -v 'Permission denied'
chmod 444 ${locdb}
@ -58,7 +58,7 @@ makewhatis.local "${MANPATH}"
#echo ""
#echo "Reformatting manual pages:"
#echo catman.local "${MANPATH}" | su -m man
#echo catman.local "${MANPATH}" | su -fm man
echo ""
echo "Cleaning up kernel database files:"