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