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