xref: /original-bsd/etc/rc (revision fa921481)
1#
2#	@(#)rc	5.15 (Berkeley) 06/04/90
3#
4
5HOME=/; export HOME
6PATH=/sbin:/bin:/usr/sbin:/usr/bin
7export PATH
8
9if [ -r /fastboot ]
10then
11	rm -f /fastboot
12	echo Fast boot ... skipping disk checks >/dev/console
13elif [ $1x = autobootx ]
14then
15	echo Automatic reboot in progress... 		>/dev/console
16	fsck -p						>/dev/console 2>&1
17	case $? in
18	0)
19		;;
20	2)
21		exit 1
22		;;
23	4)
24		reboot -n
25		echo "reboot -n failed... help!" >/dev/console
26		exit 1
27		;;
28	8)
29		echo "Automatic file system check failed... help!" >/dev/console
30		exit 1
31		;;
32	12)
33		echo "Reboot interrupted" >/dev/console
34		exit 1
35		;;
36	130)
37		# interrupt before catcher installed
38		exit 1
39		;;
40	*)
41		echo "Unknown error in reboot" > /dev/console
42		exit 1
43		;;
44	esac
45fi
46
47swapon -a						>/dev/console 2>&1
48
49umount -a
50mount -a -t nonfs					>/dev/console 2>&1
51rm -f /fastboot		# XXX
52
53# clean up left-over files
54rm -f /etc/nologin
55rm -f /var/spool/uucp/LCK.*
56rm -f /var/spool/uucp/STST/*
57(cd /var/run; rm -rf *; cp /dev/null utmp; chmod 644 utmp)
58
59# set hostname, turn on network
60. /etc/netstart
61
62mount -a -t nfs &	# XXX shouldn't need background
63
64echo -n 'starting system logger'			>/dev/console
65rm -f /dev/log
66syslogd
67
68# $timedflags is imported from /etc/netstart;
69# if $timedflags == NO, timed isn't run.
70if [ X${timedflags} != X"NO" ]; then
71    echo -n ', time daemon'	>/dev/console;	timed $timedflags
72fi
73echo    '.'						>/dev/console
74
75# /var/crash should be a directory or a symbolic link
76# to the crash directory if core dumps are to be saved.
77if [ -d /var/crash ]; then
78	echo 'checking for core dump... '		>/dev/console
79 	savecore /var/crash				>/dev/console 2>&1
80fi
81
82			echo -n 'checking quotas:'	>/dev/console
83quotacheck -a						>/dev/console 2>&1
84			echo ' done.'			>/dev/console
85quotaon -a						>/dev/console 2>&1
86
87# build kvm database
88kvm_mkdb						>/dev/console 2>&1
89
90chmod 666 /dev/tty[pqrs]*
91
92# check the password temp/lock file
93if [ -f /etc/ptmp ]
94then
95	logger -s -p auth.err \
96	'password file may be incorrect -- /etc/ptmp exists' >/dev/console 2>&1
97fi
98
99echo preserving editor files  >/dev/console
100(cd /var/tmp; /usr/libexec/ex3.7preserve -a)
101(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])
102
103echo clearing /tmp 	>/dev/console
104# prune quickly with one rm, then use find to clean up /tmp/[lq]*
105(cd /tmp; rm -rf [a-km-pr-zA-Z]* )
106(cd /tmp; find . ! -name . ! -name lost+found ! -name quotas -exec rm -r {} \; )
107
108echo -n standard daemons: >/dev/console
109echo -n ' update'	>/dev/console;	update
110echo -n ' cron'		>/dev/console;	cron
111echo -n ' accounting'	>/dev/console;	accton /var/account/acct
112echo    '.'		>/dev/console
113
114echo -n starting network daemons: >/dev/console
115
116# $routedflags is imported from /etc/netstart;
117# if $routedflags == NO, routed isn't run.
118if [ X${routedflags} != X"NO" ]; then
119    echo -n ' routed'	>/dev/console; routed $routedflags
120fi
121
122echo -n ' named'	>/dev/console;	named >/dev/console 2>&1
123echo -n ' inetd'	>/dev/console;	inetd
124
125# $rwhod is imported from /etc/netstart;
126# if $rwhod is set to something other than NO, rwhod is run.
127if [ ${rwhod-NO} != "NO" ]; then
128    echo -n ' rwhod'	>/dev/console;	rwhod
129fi
130
131echo -n ' printer'	>/dev/console;	lpd
132echo    '.'		>/dev/console
133
134sh /etc/rc.local
135
136date			>/dev/console
137exit 0
138