Annotation of src/etc/rc, Revision 1.48
1.45 cgd 1: # from: @(#)rc 8.2 (Berkeley) 3/17/94
1.48 ! mycroft 2: # $Id: rc,v 1.47 1994/06/27 21:14:19 deraadt Exp $
1.1 cgd 3:
4: # System startup script run by init on autoboot
5: # or after single-user.
6: # Output and error are redirected to console by init,
7: # and the console is the controlling terminal.
8:
9: stty status '^T'
10:
11: # Set shell to ignore SIGINT (2), but not children;
12: # shell catches SIGQUIT (3) and returns to single user after fsck.
13: trap : 2
14: trap : 3 # shouldn't be needed
15:
16: HOME=/; export HOME
17: PATH=/sbin:/bin:/usr/sbin:/usr/bin
18: export PATH
19:
1.17 mycroft 20: if [ -e /fastboot ]
1.1 cgd 21: then
1.38 cgd 22: echo "Fast boot: skipping disk checks."
1.1 cgd 23: elif [ $1x = autobootx ]
24: then
1.38 cgd 25: echo "Automatic boot in progress: starting file system checks."
1.1 cgd 26: fsck -p
27: case $? in
28: 0)
29: ;;
30: 2)
31: exit 1
32: ;;
33: 4)
1.35 cgd 34: echo "Rebooting..."
1.1 cgd 35: reboot
1.38 cgd 36: echo "Reboot failed; help!"
1.1 cgd 37: exit 1
38: ;;
39: 8)
1.38 cgd 40: echo "Automatic file system check failed; help!"
1.1 cgd 41: exit 1
42: ;;
43: 12)
1.38 cgd 44: echo "Boot interrupted."
1.1 cgd 45: exit 1
46: ;;
47: 130)
48: # interrupt before catcher installed
49: exit 1
50: ;;
51: *)
1.38 cgd 52: echo "Unknown error; help!"
1.1 cgd 53: exit 1
54: ;;
55: esac
56: fi
57:
1.38 cgd 58: trap "echo 'Boot interrupted.'; exit 1" 3
1.1 cgd 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)
1.40 cgd 65:
66: # set flags on ttys. (do early, in case they use tty for SLIP in netstart)
67: echo 'setting tty flags'
68: ttyflags -a
1.1 cgd 69:
70: # set hostname, turn on network
71: echo 'starting network'
72: . /etc/netstart
73:
1.26 deraadt 74: mount /usr >/dev/null 2>&1
1.42 mycroft 75: mount /var >/dev/null 2>&1
1.26 deraadt 76:
1.41 jtc 77: # clean up left-over files
78: rm -f /etc/nologin
79: rm -f /var/spool/lock/LCK.*
80: rm -f /var/spool/uucp/STST/*
1.45 cgd 81: (cd /var/run && { rm -rf -- *; install -c -m 664 -g utmp /dev/null utmp; })
1.41 jtc 82:
1.26 deraadt 83: echo -n 'starting rpc daemons:'
84: echo -n ' portmap'; portmap
85:
86: if [ -f /usr/sbin/ypbind -a -d /var/yp ]; then
87: echo -n ' ypbind'; ypbind
88: fi
89:
90: # $nfs_server is imported from /etc/netstart;
91: # if $nfs_server == YES, the machine is setup for being an nfs server
92: if [ X${nfs_server} = X"YES" -a -r /etc/exports ]; then
93: rm -f /var/db/mountdtab
1.48 ! mycroft 94: echo -n > /var/db/mountdtab
1.26 deraadt 95: echo -n ' mountd'; mountd
1.44 mycroft 96: echo -n ' nfsd'; nfsd -tun 4
1.26 deraadt 97: fi
98:
99: # $nfs_client is imported from /etc/netstart;
100: # if $nfs_client == YES, the machine is setup for being an nfs client
101: if [ X${nfs_client} = X"YES" ]; then
1.44 mycroft 102: echo -n ' nfsiod'; nfsiod -n 4
1.26 deraadt 103: fi
104:
1.36 cgd 105: if [ X${amd} = X"YES" -a -d ${amd_dir} -a -r ${amd_master} ]; then
1.27 deraadt 106: echo -n ' amd'
1.39 cgd 107: amd -l syslog -x error,noinfo,nostats -p > /var/run/amd.pid \
108: -a ${amd_dir} `cat ${amd_master}`
1.27 deraadt 109: fi
110:
1.26 deraadt 111: echo '.'
1.27 deraadt 112: mount -a -t nfs
1.1 cgd 113:
114: echo -n 'starting system logger'
115: rm -f /dev/log
116: syslogd
117:
1.19 cgd 118: # $timed_flags is imported from /etc/netstart;
119: # if $timed_flags == NO, timed isn't run.
1.21 cgd 120: if [ "X${timed_flags}" != X"NO" ]; then
1.19 cgd 121: echo -n ', time daemon'; timed $timed_flags
1.1 cgd 122: fi
123: echo '.'
124:
125: # /var/crash should be a directory or a symbolic link
126: # to the crash directory if core dumps are to be saved.
127: if [ -d /var/crash ]; then
128: echo checking for core dump...
129: savecore /var/crash
130: fi
131:
1.47 deraadt 132: echo -n 'checking quotas:'
133: quotacheck -a
134: echo ' done.'
135: quotaon -a
1.1 cgd 136:
137: # build ps databases
1.2 cgd 138: echo 'building databases...'
1.11 cgd 139: kvm_mkdb /netbsd
1.1 cgd 140: dev_mkdb
141:
142: chmod 666 /dev/tty[pqrs]*
143:
144: # check the password temp/lock file
145: if [ -f /etc/ptmp ]
146: then
147: logger -s -p auth.err \
148: 'password file may be incorrect -- /etc/ptmp exists'
149: fi
150:
1.32 mycroft 151: virecovery=/var/tmp/vi.recover/recover.*
152: if [ "$virecovery" != "/var/tmp/vi.recover/recover.*" ]; then
153: echo preserving editor files
154: for i in $virecovery; do
155: sendmail -t < $i
156: done
157: fi
1.1 cgd 158:
159: echo clearing /tmp
160:
161: # prune quickly with one rm, then use find to clean up /tmp/[lq]*
162: # (not needed with mfs /tmp, but doesn't hurt there...)
163: (cd /tmp && rm -rf [a-km-pr-zA-Z]* &&
1.46 deraadt 164: find . ! -name . ! -name lost+found ! -name quota.user \
165: ! -name quota.group -exec rm -rf -- {} \; -type d -prune)
1.1 cgd 166:
1.34 cgd 167: if [ -f /var/account/acct ]; then
168: echo 'turning on accounting'; accton /var/account/acct
169: fi
1.1 cgd 170:
171: echo -n standard daemons:
172: echo -n ' update'; update
1.31 jtc 173: echo -n ' cron'; cron
1.1 cgd 174: echo '.'
175:
176: echo -n starting network daemons:
177:
1.19 cgd 178: # $gated and $routed_flags are imported from /etc/netstart.
1.1 cgd 179: # If $gated == YES, gated is used; otherwise routed.
1.19 cgd 180: # If $routed_flags == NO, routed isn't run.
1.1 cgd 181: if [ X${gated} = X"YES" -a -r /etc/gated.conf ]; then
1.48 ! mycroft 182: echo -n ' gated'; gated $gated_flags
1.21 cgd 183: elif [ "X${routed_flags}" != X"NO" ]; then
1.48 ! mycroft 184: echo -n ' routed'; routed $routed_flags
1.1 cgd 185: fi
186:
1.19 cgd 187: # $name_server is imported from /etc/netstart;
1.48 ! mycroft 188: # if $named_flags != NO, named is run.
! 189: if [ "X${named_flags}" != X"NO" ]; then
! 190: echo -n ' named'; named $named_flags
1.29 mycroft 191: fi
192:
1.1 cgd 193: # $rwhod is imported from /etc/netstart;
1.2 cgd 194: # if $rwhod == YES, rwhod is run.
1.5 cgd 195: if [ X${rwhod} = X"YES" ]; then
1.48 ! mycroft 196: echo -n ' rwhod'; rwhod
1.1 cgd 197: fi
198:
199: echo -n ' printer'; lpd
1.6 cgd 200:
1.19 cgd 201: # $sendmail_flags is imported from /etc/netstart;
1.24 cgd 202: # If $sendmail_flags == NO or /etc/sendmail.cf doesn't exist, then
203: # sendmail isn't run.
204: if [ "X${sendmail_flags}" != X"NO" -a -r /etc/sendmail.cf ]; then
1.19 cgd 205: echo -n ' sendmail'; sendmail ${sendmail_flags}
206: fi
207:
1.1 cgd 208: echo -n ' inetd'; inetd
1.30 mycroft 209:
210: # $rarpd_flags is importent from /etc/netstart;
211: # If $rarpd_flags == NO or /etc/ethers doesn't exist, then
212: # rarpd isn't run.
213: if [ "X${rarpd_flags}" != X"NO" -a -r /etc/ethers ]; then
214: echo -n ' rarpd'; rarpd ${rarpd_flags}
215: fi
216:
217: # $bootparamd_flags is importent from /etc/netstart;
218: # If $bootparamd_flags == NO or /etc/bootparams doesn't exist, then
219: # bootparamd isn't run.
220: if [ "X${bootparamd_flags}" != X"NO" -a -r /etc/bootparams ]; then
221: echo -n ' rpc.bootparamd'; rpc.bootparamd ${bootparamd_flags}
222: fi
223:
1.1 cgd 224: echo '.'
225:
1.25 mycroft 226: . /etc/rc.local
1.1 cgd 227:
228: date
229: exit 0
CVSweb <webmaster@jp.NetBSD.org>