more reorg; paranoia; accumulated changes
[unix-history] / usr / src / etc / rc
CommitLineData
8c5cf0c6 1#
ac03770e 2# @(#)rc 5.9 (Berkeley) %G%
8c5cf0c6
KB
3#
4
aa77a7dd 5HOME=/; export HOME
3dc1e9d1 6PATH=/sbin:/bin:/usr/sbin:/usr/bin
1a91d88f 7export PATH
aa77a7dd
KB
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
aa77a7dd
KB
16 fsck -p >/dev/console 2>&1
17 case $? in
18 0)
aa77a7dd
KB
19 ;;
20 2)
21 exit 1
22 ;;
23 4)
24 reboot -n
eca41594
MK
25 echo "reboot -n failed... help!" >/dev/console
26 exit 1
aa77a7dd
KB
27 ;;
28 8)
eca41594 29 echo "Automatic file system check failed... help!" >/dev/console
aa77a7dd
KB
30 exit 1
31 ;;
32 12)
33 echo "Reboot interrupted" >/dev/console
34 exit 1
35 ;;
eca41594
MK
36 130)
37 # interrupt before catcher installed
38 exit 1
39 ;;
aa77a7dd
KB
40 *)
41 echo "Unknown error in reboot" > /dev/console
42 exit 1
43 ;;
44 esac
aa77a7dd
KB
45fi
46
aa77a7dd 47swapon -a >/dev/console 2>&1
e6794cca
KB
48
49umount -a
aa77a7dd
KB
50mount -a >/dev/console 2>&1
51
e6794cca
KB
52# clean up left-over files
53rm -f /etc/nologin
54rm -f /usr/spool/uucp/LCK.*
55rm -f /usr/spool/uucp/STST/*
56(cd /var/run; rm -rf *)
57
aa77a7dd
KB
58# set hostname, turn on network
59. /etc/netstart
60
e6794cca 61echo 'starting system logger' >/dev/console
aa77a7dd
KB
62rm -f /dev/log
63syslogd
64
3dc1e9d1
MK
65# /var/crash should be a directory or a symbolic link
66# to the crash directory if core dumps are to be saved.
aa77a7dd 67if [ -d /var/crash ]; then
e6794cca
KB
68 echo 'checking for core dump... ' >/dev/console
69 savecore /var/crash >/dev/console 2>&1
aa77a7dd
KB
70fi
71
5e8595e4
KB
72 echo -n 'checking quotas:' >/dev/console
73quotacheck -a -p >/dev/console 2>&1
74 echo ' done.' >/dev/console
8bfb622e 75quotaon -a >/dev/console 2>&1
5e8595e4
KB
76
77# build ps data base
78ps -U >/dev/console 2>&1
79
80chmod 666 /dev/tty[pqrs]*
81
eca41594
MK
82# check the password temp/lock file
83if [ -f /etc/ptmp ]
84then
85 logger -s -p auth.err \
86 'password file may be incorrect -- /etc/ptmp exists' >/dev/console 2>&1
87fi
88
3dc1e9d1 89echo preserving editor files >/dev/console
ac03770e 90(cd /var/tmp; /usr/libexec/ex3.7preserve -a)
3dc1e9d1 91echo clearing /tmp >/dev/console
eca41594 92(cd /tmp; rm -rf [a-km-pr-zA-Z]* )
aa77a7dd
KB
93(cd /tmp; find . ! -name . ! -name lost+found ! -name quotas -exec rm -r {} \; )
94
3dc1e9d1
MK
95echo -n standard daemons: >/dev/console
96echo -n ' update' >/dev/console; update
97echo -n ' cron' >/dev/console; cron
98echo -n ' accounting' >/dev/console; accton /var/account/acct
99echo '.' >/dev/console
aa77a7dd 100
3dc1e9d1 101echo -n starting network daemons: >/dev/console
aa77a7dd
KB
102
103# $routedflags is imported from /etc/netstart;
104# if $routedflags == NO, routed isn't run.
105if [ X${routedflags} != X"NO" ]; then
3dc1e9d1 106 echo -n ' routed' >/dev/console; routed $routedflags
aa77a7dd
KB
107fi
108
3dc1e9d1
MK
109echo -n ' named' >/dev/console; named >/dev/console 2>&1
110echo -n ' inetd' >/dev/console; inetd
aa77a7dd
KB
111
112# $rwhod is imported from /etc/netstart;
113# if $rwhod is set to something other than NO, rwhod is run.
114if [ ${rwhod-NO} != "NO" ]; then
3dc1e9d1 115 echo -n ' rwhod' >/dev/console; rwhod
aa77a7dd
KB
116fi
117
3dc1e9d1
MK
118echo -n ' printer' >/dev/console; lpd
119echo '.' >/dev/console
aa77a7dd
KB
120
121sh /etc/rc.local
122
3dc1e9d1 123date >/dev/console
aa77a7dd 124exit 0