minor lint; initialize modrev time for NFS leases
[unix-history] / usr / src / etc / rc
CommitLineData
f4ff1534 1# @(#)rc 5.27 (Berkeley) %G%
8c5cf0c6 2
a15e1c64
MK
3# System startup script run by init on autoboot
4# or after single-user.
5# Output and error are redirected to console by init,
6# and the console is the controlling terminal.
7
f4ff1534
MK
8stty status '^T'
9
a15e1c64
MK
10# Set shell to ignore SIGINT (2), but not children;
11# shell catches SIGQUIT (3) and returns to single user after fsck.
12trap : 2
f4ff1534 13trap : 3 # shouldn't be needed
a15e1c64 14
aa77a7dd 15HOME=/; export HOME
3dc1e9d1 16PATH=/sbin:/bin:/usr/sbin:/usr/bin
1a91d88f 17export PATH
aa77a7dd
KB
18
19if [ -r /fastboot ]
20then
14f88e09 21 echo Fast boot ... skipping disk checks
aa77a7dd
KB
22elif [ $1x = autobootx ]
23then
14f88e09
KB
24 echo Automatic reboot in progress...
25 fsck -p
aa77a7dd
KB
26 case $? in
27 0)
aa77a7dd
KB
28 ;;
29 2)
30 exit 1
31 ;;
32 4)
a15e1c64 33 reboot
14f88e09 34 echo "reboot failed... help!"
eca41594 35 exit 1
aa77a7dd
KB
36 ;;
37 8)
14f88e09 38 echo "Automatic file system check failed... help!"
aa77a7dd
KB
39 exit 1
40 ;;
41 12)
14f88e09 42 echo "Reboot interrupted"
aa77a7dd
KB
43 exit 1
44 ;;
eca41594
MK
45 130)
46 # interrupt before catcher installed
47 exit 1
48 ;;
aa77a7dd 49 *)
14f88e09 50 echo "Unknown error in reboot"
aa77a7dd
KB
51 exit 1
52 ;;
53 esac
aa77a7dd
KB
54fi
55
a15e1c64
MK
56trap "echo 'Reboot interrupted'; exit 1" 3
57
14f88e09 58swapon -a
e6794cca 59
ad4f198f 60umount -a >/dev/null 2>&1
14f88e09 61mount -a -t nonfs
c2ce0042 62rm -f /fastboot # XXX (root now writeable)
e6794cca 63
aa77a7dd 64# set hostname, turn on network
00e5ee90 65echo 'starting network'
aa77a7dd
KB
66. /etc/netstart
67
ad4f198f 68mount -a -t nfs >/dev/null 2>&1 & # XXX shouldn't need background
c404d670 69
c2ce0042
MK
70# clean up left-over files
71rm -f /etc/nologin
72rm -f /var/spool/uucp/LCK.*
73rm -f /var/spool/uucp/STST/*
6e50c619 74(cd /var/run && { rm -rf -- *; cp /dev/null utmp; chmod 644 utmp; })
c2ce0042 75
14f88e09 76echo -n 'starting system logger'
aa77a7dd
KB
77rm -f /dev/log
78syslogd
79
c404d670
MK
80# $timedflags is imported from /etc/netstart;
81# if $timedflags == NO, timed isn't run.
82if [ X${timedflags} != X"NO" ]; then
14f88e09 83 echo -n ', time daemon'; timed $timedflags
c404d670 84fi
14f88e09 85echo '.'
c404d670 86
3dc1e9d1
MK
87# /var/crash should be a directory or a symbolic link
88# to the crash directory if core dumps are to be saved.
aa77a7dd 89if [ -d /var/crash ]; then
f4ff1534 90 echo checking for core dump...
14f88e09 91 savecore /var/crash
aa77a7dd
KB
92fi
93
14f88e09
KB
94 echo -n 'checking quotas:'
95quotacheck -a
96 echo ' done.'
97quotaon -a
5e8595e4 98
d48f0247
KB
99# build ps databases
100kvm_mkdb /vmunix
e0804fa4 101dev_mkdb
5e8595e4
KB
102
103chmod 666 /dev/tty[pqrs]*
104
eca41594
MK
105# check the password temp/lock file
106if [ -f /etc/ptmp ]
107then
108 logger -s -p auth.err \
14f88e09 109 'password file may be incorrect -- /etc/ptmp exists'
eca41594
MK
110fi
111
14f88e09 112echo preserving editor files
c2ce0042
MK
113(cd /var/tmp && /usr/libexec/ex3.7preserve -a &&
114 rm -f Ex[0-9][0-9][0-9][0-9][0-9] Rx[0-9][0-9][0-9][0-9][0-9])
c404d670 115
14f88e09
KB
116echo clearing /tmp
117
c404d670 118# prune quickly with one rm, then use find to clean up /tmp/[lq]*
a15e1c64 119# (not needed with mfs /tmp, but doesn't hurt there...)
c2ce0042 120(cd /tmp && rm -rf [a-km-pr-zA-Z]* &&
6e50c619 121 find . ! -name . ! -name lost+found ! -name quotas -exec rm -rf -- {} \;)
aa77a7dd 122
14f88e09
KB
123echo 'turning on accounting'; accton /var/account/acct
124
125echo -n standard daemons:
126echo -n ' update'; update
127echo -n ' cron'; cron
128echo '.'
aa77a7dd 129
14f88e09 130echo -n starting network daemons:
aa77a7dd 131
2fef9d3c
MK
132# $gated and $routedflags are imported from /etc/netstart.
133# If $gated == YES, gated is used; otherwise routed.
134# If $routedflags == NO, routed isn't run.
135if [ X${gated} = X"YES" -a -r /etc/gated.conf ]; then
c2ce0042 136 echo -n ' gated'; gated $gatedflags
2fef9d3c 137elif [ X${routedflags} != X"NO" ]; then
14f88e09 138 echo -n ' routed'; routed $routedflags
aa77a7dd
KB
139fi
140
14f88e09 141echo -n ' named'; named
aa77a7dd
KB
142
143# $rwhod is imported from /etc/netstart;
144# if $rwhod is set to something other than NO, rwhod is run.
145if [ ${rwhod-NO} != "NO" ]; then
14f88e09 146 echo -n ' rwhod'; rwhod
aa77a7dd
KB
147fi
148
14f88e09
KB
149echo -n ' printer'; lpd
150
ad4f198f 151echo -n ' portmap'; portmap
14f88e09
KB
152echo -n ' mountd'; mountd
153echo -n ' nfsd'; nfsd -u 0,0,4 -t 0,0
154echo -n ' nfsiod'; nfsiod 4
155
156echo -n ' sendmail'; sendmail -bd -q30m
f4ff1534 157echo -n ' inetd'; inetd
14f88e09 158echo '.'
aa77a7dd
KB
159
160sh /etc/rc.local
161
14f88e09 162date
aa77a7dd 163exit 0