#! /bin/sh
#
# System startup commands.  Do not edit this file, instead put local mods
# into /etc/rc.local
#
# $Source: /d2/3.7/src/etc/RCS/rc,v $
# $Revision: 1.1 $
# $Date: 89/03/27 15:38:27 $
#

TZ=`cat /etc/TZ`
export TZ

# Initialization for terminals
case `/bin/uname -t` in
2300|2300T|3010)
	PATH=':/usr/bin:/bin:/etc'
	export PATH
	rm -rf /tmp/* /tmp/.??*;	echo "Cleared /tmp"
	if test ! -d /tmp; then
		rm -rf /tmp; mkdir /tmp; chmod a+w /tmp
	fi
	if test -f /.mexrc; then
    		su iris -c 'SHELL=/bin/tesh HOME=/ TERM=wsiris mex' 
	fi
	if test -r /etc/sys_id; then 
		hostname `cat /etc/sys_id` 
					echo Hostname: `hostname`
	else
					echo No hostname
	fi	
#					echo "Standard daemons:\c"
	if test -f /etc/rc.tcp; then sh /etc/rc.tcp; fi
	if test -f /etc/rc.xns; then sh /etc/rc.xns; fi
	if test -f /etc/rc.488; then sh /etc/rc.488; fi
	sleep 3
	clear
	exit
	;;
esac

# Intialization for workstations
PATH=':/usr/local/bin:/usr/bin:/bin:/etc'
export PATH
set `who -r`
if [ $7 = 2 -o $7 = 3 ]
then
	/etc/mount -avt efs
	/etc/mount -avt bell

					echo "Resetting locks and logs"
	rm -f /usr/spool/lpd/lock /usr/spool/lp/SCHEDLOCK
	rm -f /usr/adm/acct/nite/lock*
	(cd /usr/spool/uucp; rm -f LCK*; rm -f STST*; rm -f TM*);
	rm -f /usr/mail/*.lock

	hostname `cat /etc/sys_id`
					echo Hostname: `hostname`

# Start standard daemons
					echo "Standard daemons:\c"
	rm -f /dev/log /etc/syslog.pid
	if test -x /usr/etc/syslogd; then
		date '+/etc/rc starting syslogd at %D, %T' >> /usr/adm/SYSLOG
		/usr/etc/syslogd;	echo " syslogd\c"
	fi
#  Uncomment the following 3 lines if you want to use Berkeley's lpd
#	if test -x /usr/lib/lpd ; then
#		/usr/lib/lpd;		echo " lpd\c"
#	fi

	if test -x /usr/lib/lpsched; then
		/usr/lib/lpsched;	echo " lpsched\c"
	fi
					echo "."

# Start special daemons
	if test -f /etc/rc.tcp; then sh /etc/rc.tcp; fi
	if test -f /etc/rc.xns; then sh /etc/rc.xns; fi
	if test -f /etc/rc.nfs; then sh /etc/rc.nfs; fi
	if test -f /etc/rc.488; then sh /etc/rc.488; fi
	if test -f /etc/rc.mail; then sh /etc/rc.mail; fi

					echo "More standard daemons:\c"
	date '+/etc/rc starting cron at %D, %T' >> /usr/adm/cronlog
	/etc/cron;			echo " cron\c"
					echo "."

# Run expreserve after starting sendmail, so that mail messages
# can be sent to the owners of vi work files
	/usr/lib/ex3.7preserve -;	echo "Preserved editor files"
	rm -rf /tmp/* /tmp/.??*;	echo "Cleared /tmp"
	if test ! -d /tmp; then
		rm -rf /tmp; mkdir /tmp; chmod a+w /tmp
	fi

	if test -f /etc/rc.local; then sh /etc/rc.local; fi
fi

chmod +rw /dev/ttyw*
