#! /bin/csh -f # # Wendy - the Weekly Helper (weekly maintenance, aside from cleaning) # # Wendy generally does stuff like rebuilding databases for mail aliases # or man pages and other system administration, but not cleaning (see # Cora for that) and not security (see Walter for that). # # Eric Myers - 18 July 1996 # Department of Physics, University of Michigan, Ann Arbor # @(#) $Id: Wendy,v 1.29 2008/09/23 16:33:06 myers Exp myers $ ####################################################################### # Set the path just to what is needed, nothing else. set path=( /usr/local/adm /usr/bin /usr/sbin /usr/ucb /etc /usr/etc ) set path=( $path /bin /sbin ) set TMP=/tmp/Wendy.$$ set LOG=/tmp/Wendy.out set HOSTNAME = `hostname` set INDENT="pr -o 8 -t " set RCSVERS = \ `echo '$Revision: 1.29 $' | sed -e 's/Revision: //' -e 's/$\(.*\) \$/\1/'` ## # MAILX is mail/mailx or mush, with -s for subject # set MAILX="mail -s " # NeXT/Linux/Sun if ( -x /usr/bin/mailx ) then # HP-UX set MAILX="/usr/bin/mailx -s " endif if ( -x /usr/local/bin/mush ) then # mush is prefered set MAILX="/usr/local/bin/mush -s " endif #################### ## @(#)* Rebuild sendmail alias database newaliases #################### ## @(#)* Rebuild man pages 'whatis' index ## [but only if it is on a local (not NFS) filesystem] set MANNFS = `df /usr/man | awk '$1 ~ /:/ { print $1 }'` if ( "$MANNFS" == "" ) then if ( -x /usr/sbin/catman ) /usr/sbin/catman -w # HP-UX if ( -x /etc/catman ) /etc/catman -w # NeXTstep if ( -x /usr/etc/catman ) /usr/etc/catman -w # SunOS 4.x if ( -x /usr/sbin/makewhatis ) /usr/sbin/makewhatis # Linux endif #################### ## @(#)* Update GNU locate database if ( -x /usr/bin/updatedb ) then /usr/bin/updatedb endif #################### ## @(#)* Rebuild tex ls-R hash index set TEXHASH=`which texhash | egrep -v "not found|no texhash in"` if ( $TEXHASH != "" ) then $TEXHASH endif #################### ## @(#)* Rebuild slocate databse, if slocate exists set SLOCATE=`which slocate | egrep -v "not found|no slocate in"` if ( $SLOCATE != "") then slocate -u -f "nfs,smbfs,ncpfs,proc,devpts" -e "/tmp,/var/tmp,/usr/tmp,/afs,/net" endif #################### ## @(#)* Start new debug log, if in use set SYSLOG=( /var/log/debug /var/adm/debug /var/adm/syslog/debug ) foreach FILE ( $SYSLOG ) if( -f $FILE && ! -z $FILE ) newlog $FILE 8 644 end #################### ## @(#)* Check for backed up mailq # first see that sendmail exists at all (check for qmail someday?) set SENDMAIL="" if ( -x /usr/lib/sendmail.sendmail ) then set SENDMAIL="/usr/lib/sendmail.sendmail" else if ( -x /usr/sbin/sendmail ) then set SENDMAIL="/usr/sbin/sendmail" else if ( -x /usr/lib/sendmail ) then set SENDMAIL="/usr/lib/sendmail" else set SENDMAIL=`which sendmail` endif # Try to flush the queue first if ( -x $SENDMAIL ) then $SENDMAIL -qf endif cat /dev/null >$TMP # then check for stuff that's stuck mailq -v | tail -2 >$TMP if ( ! -z $TMP ) then echo " " >>${LOG} echo "### Mail queue is not empty:" >>${LOG} echo " " >>${LOG} cat $TMP >>${LOG} echo " " >>${LOG} endif rm -f $TMP ################################################## ## @(#)* Mail a report to root of anything found if ( -f $LOG && ! -z $LOG ) then (echo "#### System configuration report for $HOSTNAME from Wendy $RCSVERS "; \ cat $LOG ) | $MAILX "System configuration report for $HOSTNAME" root endif # Clean up: /bin/rm -f $LOG $TMP exit 0