4.3BSD-Reno/src/etc/rc.calder

#
#	@(#)rc	5.14 (sort of) (Berkeley) 5/31/90
#

# System startup script run by init on autoboot
# or after single-user.
# Output and error are redirected to console by init,
# and the console is the controlling terminal.

# Set shell to ignore SIGINT (2), but not children;
# shell catches SIGQUIT (3) and returns to single user after fsck.
trap : 2

HOME=/; export HOME
PATH=/sbin:/bin:/usr/sbin:/usr/bin
export PATH

if [ -r /fastboot ]
then
	echo Fast boot ... skipping disk checks >/dev/console
elif [ $1x = autobootx ]
then
	echo Automatic reboot in progress... 		>/dev/console
	fsck -p						>/dev/console 2>&1
	case $? in
	0)
		;;
	2)
		exit 1
		;;
	4)
		reboot
		echo "reboot failed... help!" >/dev/console
		exit 1
		;;
	8)
		echo "Automatic file system check failed... help!" >/dev/console
		exit 1
		;;
	12)
		echo "Reboot interrupted" >/dev/console
		exit 1
		;;
	130)
		# interrupt before catcher installed
		exit 1
		;;
	*)
		echo "Unknown error in reboot" > /dev/console
		exit 1
		;;
	esac
fi

trap "echo 'Reboot interrupted'; exit 1" 3

swapon -a						>/dev/console 2>&1

umount -a
mount -a -t nonfs					>/dev/console 2>&1
rm -f /fastboot		# XXX

# clean up left-over files
rm -f /etc/nologin
rm -f /var/spool/uucp/LCK.*
rm -f /var/spool/uucp/STST/*
(cd /var/run; rm -rf *; cp /dev/null utmp; chmod 644 utmp)

# set hostname, turn on network
. /etc/netstart

mount -a -t nfs &	# XXX shouldn't need background

echo -n 'starting system logger'			>/dev/console
rm -f /dev/log
syslogd

# $timedflags is imported from /etc/netstart;
# if $timedflags == NO, timed isn't run.
if [ X${timedflags} != X"NO" ]; then
    echo -n ', time daemon'	>/dev/console;	timed $timedflags
fi
echo    '.'						>/dev/console

# /var/crash should be a directory or a symbolic link
# to the crash directory if core dumps are to be saved.
if [ -d /var/crash ]; then
	echo 'checking for core dump... '		>/dev/console
 	savecore /var/crash				>/dev/console 2>&1
fi

			echo -n 'checking quotas:'	>/dev/console
quotacheck -a						>/dev/console 2>&1
			echo ' done.'			>/dev/console
quotaon -a						>/dev/console 2>&1

# build kvm database
kvm_mkdb						>/dev/console 2>&1

chmod 666 /dev/tty[pqrs]*

# check the password temp/lock file
if [ -f /etc/ptmp ]
then
	logger -s -p auth.err \
	'password file may be incorrect -- /etc/ptmp exists' >/dev/console 2>&1
fi

echo preserving editor files  >/dev/console
(cd /var/tmp; /usr/libexec/ex3.7preserve -a)
(cd /var/tmp; rm Ex[0-9][0-9][0-9][0-9][0-9] Rx[0-9][0-9][0-9][0-9][0-9])

echo clearing /tmp 	>/dev/console
# prune quickly with one rm, then use find to clean up /tmp/[lq]*
(cd /tmp; rm -rf [a-km-pr-zA-Z]* )
(cd /tmp; find . ! -name . ! -name lost+found ! -name quotas -exec rm -r {} \; )

echo -n standard daemons: >/dev/console
echo -n ' update'	>/dev/console;	update
echo -n ' cron'		>/dev/console;	cron
echo -n ' accounting'	>/dev/console;	accton /var/account/acct
echo    '.'		>/dev/console

echo -n starting network daemons: >/dev/console

# $routedflags is imported from /etc/netstart;
# if $routedflags == NO, routed isn't run.
if [ X${routedflags} != X"NO" ]; then
    echo -n ' routed'	>/dev/console; routed $routedflags
fi

echo -n ' named'	>/dev/console;	named >/dev/console 2>&1
echo -n ' inetd'	>/dev/console;	inetd

# $rwhod is imported from /etc/netstart;
# if $rwhod is set to something other than NO, rwhod is run.
if [ ${rwhod-NO} != "NO" ]; then
    echo -n ' rwhod'	>/dev/console;	rwhod
fi

echo -n ' printer'	>/dev/console;	lpd
echo    '.'		>/dev/console

sh /etc/rc.local

date			>/dev/console
exit 0