Commit | Line | Data |
---|---|---|
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 |
8 | stty 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. | |
12 | trap : 2 | |
f4ff1534 | 13 | trap : 3 # shouldn't be needed |
a15e1c64 | 14 | |
aa77a7dd | 15 | HOME=/; export HOME |
3dc1e9d1 | 16 | PATH=/sbin:/bin:/usr/sbin:/usr/bin |
1a91d88f | 17 | export PATH |
aa77a7dd KB |
18 | |
19 | if [ -r /fastboot ] | |
20 | then | |
14f88e09 | 21 | echo Fast boot ... skipping disk checks |
aa77a7dd KB |
22 | elif [ $1x = autobootx ] |
23 | then | |
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 |
54 | fi |
55 | ||
a15e1c64 MK |
56 | trap "echo 'Reboot interrupted'; exit 1" 3 |
57 | ||
14f88e09 | 58 | swapon -a |
e6794cca | 59 | |
ad4f198f | 60 | umount -a >/dev/null 2>&1 |
14f88e09 | 61 | mount -a -t nonfs |
c2ce0042 | 62 | rm -f /fastboot # XXX (root now writeable) |
e6794cca | 63 | |
aa77a7dd | 64 | # set hostname, turn on network |
00e5ee90 | 65 | echo 'starting network' |
aa77a7dd KB |
66 | . /etc/netstart |
67 | ||
ad4f198f | 68 | mount -a -t nfs >/dev/null 2>&1 & # XXX shouldn't need background |
c404d670 | 69 | |
c2ce0042 MK |
70 | # clean up left-over files |
71 | rm -f /etc/nologin | |
72 | rm -f /var/spool/uucp/LCK.* | |
73 | rm -f /var/spool/uucp/STST/* | |
6e50c619 | 74 | (cd /var/run && { rm -rf -- *; cp /dev/null utmp; chmod 644 utmp; }) |
c2ce0042 | 75 | |
14f88e09 | 76 | echo -n 'starting system logger' |
aa77a7dd KB |
77 | rm -f /dev/log |
78 | syslogd | |
79 | ||
c404d670 MK |
80 | # $timedflags is imported from /etc/netstart; |
81 | # if $timedflags == NO, timed isn't run. | |
82 | if [ X${timedflags} != X"NO" ]; then | |
14f88e09 | 83 | echo -n ', time daemon'; timed $timedflags |
c404d670 | 84 | fi |
14f88e09 | 85 | echo '.' |
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 | 89 | if [ -d /var/crash ]; then |
f4ff1534 | 90 | echo checking for core dump... |
14f88e09 | 91 | savecore /var/crash |
aa77a7dd KB |
92 | fi |
93 | ||
14f88e09 KB |
94 | echo -n 'checking quotas:' |
95 | quotacheck -a | |
96 | echo ' done.' | |
97 | quotaon -a | |
5e8595e4 | 98 | |
d48f0247 KB |
99 | # build ps databases |
100 | kvm_mkdb /vmunix | |
e0804fa4 | 101 | dev_mkdb |
5e8595e4 KB |
102 | |
103 | chmod 666 /dev/tty[pqrs]* | |
104 | ||
eca41594 MK |
105 | # check the password temp/lock file |
106 | if [ -f /etc/ptmp ] | |
107 | then | |
108 | logger -s -p auth.err \ | |
14f88e09 | 109 | 'password file may be incorrect -- /etc/ptmp exists' |
eca41594 MK |
110 | fi |
111 | ||
14f88e09 | 112 | echo 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 |
116 | echo 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 |
123 | echo 'turning on accounting'; accton /var/account/acct |
124 | ||
125 | echo -n standard daemons: | |
126 | echo -n ' update'; update | |
127 | echo -n ' cron'; cron | |
128 | echo '.' | |
aa77a7dd | 129 | |
14f88e09 | 130 | echo -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. | |
135 | if [ X${gated} = X"YES" -a -r /etc/gated.conf ]; then | |
c2ce0042 | 136 | echo -n ' gated'; gated $gatedflags |
2fef9d3c | 137 | elif [ X${routedflags} != X"NO" ]; then |
14f88e09 | 138 | echo -n ' routed'; routed $routedflags |
aa77a7dd KB |
139 | fi |
140 | ||
14f88e09 | 141 | echo -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. | |
145 | if [ ${rwhod-NO} != "NO" ]; then | |
14f88e09 | 146 | echo -n ' rwhod'; rwhod |
aa77a7dd KB |
147 | fi |
148 | ||
14f88e09 KB |
149 | echo -n ' printer'; lpd |
150 | ||
ad4f198f | 151 | echo -n ' portmap'; portmap |
14f88e09 KB |
152 | echo -n ' mountd'; mountd |
153 | echo -n ' nfsd'; nfsd -u 0,0,4 -t 0,0 | |
154 | echo -n ' nfsiod'; nfsiod 4 | |
155 | ||
156 | echo -n ' sendmail'; sendmail -bd -q30m | |
f4ff1534 | 157 | echo -n ' inetd'; inetd |
14f88e09 | 158 | echo '.' |
aa77a7dd KB |
159 | |
160 | sh /etc/rc.local | |
161 | ||
14f88e09 | 162 | date |
aa77a7dd | 163 | exit 0 |