rc revision 1.38
11.26Sderaadt# @(#)rc 5.27 (Berkeley) 6/5/91 21.38Scgd# $Id: rc,v 1.38 1994/03/18 00:58:20 cgd Exp $ 31.1Scgd 41.1Scgd# System startup script run by init on autoboot 51.1Scgd# or after single-user. 61.1Scgd# Output and error are redirected to console by init, 71.1Scgd# and the console is the controlling terminal. 81.1Scgd 91.1Scgdstty status '^T' 101.1Scgd 111.1Scgd# Set shell to ignore SIGINT (2), but not children; 121.1Scgd# shell catches SIGQUIT (3) and returns to single user after fsck. 131.1Scgdtrap : 2 141.1Scgdtrap : 3 # shouldn't be needed 151.1Scgd 161.1ScgdHOME=/; export HOME 171.1ScgdPATH=/sbin:/bin:/usr/sbin:/usr/bin 181.1Scgdexport PATH 191.1Scgd 201.17Smycroftif [ -e /fastboot ] 211.1Scgdthen 221.38Scgd echo "Fast boot: skipping disk checks." 231.1Scgdelif [ $1x = autobootx ] 241.1Scgdthen 251.38Scgd echo "Automatic boot in progress: starting file system checks." 261.1Scgd fsck -p 271.1Scgd case $? in 281.1Scgd 0) 291.1Scgd ;; 301.1Scgd 2) 311.1Scgd exit 1 321.1Scgd ;; 331.1Scgd 4) 341.35Scgd echo "Rebooting..." 351.1Scgd reboot 361.38Scgd echo "Reboot failed; help!" 371.1Scgd exit 1 381.1Scgd ;; 391.1Scgd 8) 401.38Scgd echo "Automatic file system check failed; help!" 411.1Scgd exit 1 421.1Scgd ;; 431.1Scgd 12) 441.38Scgd echo "Boot interrupted." 451.1Scgd exit 1 461.1Scgd ;; 471.1Scgd 130) 481.1Scgd # interrupt before catcher installed 491.1Scgd exit 1 501.1Scgd ;; 511.1Scgd *) 521.38Scgd echo "Unknown error; help!" 531.1Scgd exit 1 541.1Scgd ;; 551.1Scgd esac 561.1Scgdfi 571.1Scgd 581.38Scgdtrap "echo 'Boot interrupted.'; exit 1" 3 591.1Scgd 601.1Scgdswapon -a 611.1Scgd 621.1Scgdumount -a >/dev/null 2>&1 631.1Scgdmount -a -t nonfs 641.1Scgdrm -f /fastboot # XXX (root now writeable) 651.1Scgd 661.1Scgd# set hostname, turn on network 671.1Scgdecho 'starting network' 681.1Scgd. /etc/netstart 691.1Scgd 701.26Sderaadtmount /usr >/dev/null 2>&1 711.26Sderaadt 721.26Sderaadtecho -n 'starting rpc daemons:' 731.26Sderaadtecho -n ' portmap'; portmap 741.26Sderaadt 751.26Sderaadtif [ -f /usr/sbin/ypbind -a -d /var/yp ]; then 761.26Sderaadt echo -n ' ypbind'; ypbind 771.26Sderaadtfi 781.26Sderaadt 791.26Sderaadt# $nfs_server is imported from /etc/netstart; 801.26Sderaadt# if $nfs_server == YES, the machine is setup for being an nfs server 811.26Sderaadtif [ X${nfs_server} = X"YES" -a -r /etc/exports ]; then 821.26Sderaadt rm -f /var/db/mountdtab 831.26Sderaadt echo -n ' mountd'; mountd 841.26Sderaadt echo -n ' nfsd'; nfsd -u 0,0,4 -t 0,0 851.26Sderaadtfi 861.26Sderaadt 871.26Sderaadt# $nfs_client is imported from /etc/netstart; 881.26Sderaadt# if $nfs_client == YES, the machine is setup for being an nfs client 891.26Sderaadtif [ X${nfs_client} = X"YES" ]; then 901.26Sderaadt echo -n ' nfsiod'; nfsiod 4 911.26Sderaadtfi 921.26Sderaadt 931.36Scgdif [ X${amd} = X"YES" -a -d ${amd_dir} -a -r ${amd_master} ]; then 941.27Sderaadt echo -n ' amd' 951.36Scgd amd -l syslog -x error,noinfo,nostats -a ${amd_dir} `cat ${amd_master}` 961.27Sderaadtfi 971.27Sderaadt 981.26Sderaadtecho '.' 991.27Sderaadtmount -a -t nfs 1001.1Scgd 1011.1Scgd# clean up left-over files 1021.1Scgdrm -f /etc/nologin 1031.37Scgdrm -f /var/spool/lock/LCK.* 1041.1Scgdrm -f /var/spool/uucp/STST/* 1051.1Scgd(cd /var/run && { rm -rf -- *; cp /dev/null utmp; chmod 644 utmp; }) 1061.23Smycroft 1071.23Smycroftecho 'runtime link editor directory cache' 1081.23Smycroftrm -f /var/run/ld.so.hints 1091.23Smycroftldconfig 1101.1Scgd 1111.1Scgdecho -n 'starting system logger' 1121.1Scgdrm -f /dev/log 1131.1Scgdsyslogd 1141.1Scgd 1151.19Scgd# $timed_flags is imported from /etc/netstart; 1161.19Scgd# if $timed_flags == NO, timed isn't run. 1171.21Scgdif [ "X${timed_flags}" != X"NO" ]; then 1181.19Scgd echo -n ', time daemon'; timed $timed_flags 1191.1Scgdfi 1201.1Scgdecho '.' 1211.1Scgd 1221.1Scgd# /var/crash should be a directory or a symbolic link 1231.1Scgd# to the crash directory if core dumps are to be saved. 1241.1Scgdif [ -d /var/crash ]; then 1251.1Scgd echo checking for core dump... 1261.1Scgd savecore /var/crash 1271.1Scgdfi 1281.1Scgd 1291.1Scgd# echo -n 'checking quotas:' 1301.1Scgd#quotacheck -a 1311.1Scgd# echo ' done.' 1321.1Scgd#quotaon -a 1331.1Scgd 1341.1Scgd# build ps databases 1351.2Scgdecho 'building databases...' 1361.11Scgdkvm_mkdb /netbsd 1371.1Scgddev_mkdb 1381.1Scgd 1391.1Scgdchmod 666 /dev/tty[pqrs]* 1401.1Scgd 1411.1Scgd# check the password temp/lock file 1421.1Scgdif [ -f /etc/ptmp ] 1431.1Scgdthen 1441.1Scgd logger -s -p auth.err \ 1451.1Scgd 'password file may be incorrect -- /etc/ptmp exists' 1461.1Scgdfi 1471.1Scgd 1481.32Smycroftvirecovery=/var/tmp/vi.recover/recover.* 1491.32Smycroftif [ "$virecovery" != "/var/tmp/vi.recover/recover.*" ]; then 1501.32Smycroft echo preserving editor files 1511.32Smycroft for i in $virecovery; do 1521.32Smycroft sendmail -t < $i 1531.32Smycroft done 1541.32Smycroftfi 1551.1Scgd 1561.1Scgdecho clearing /tmp 1571.1Scgd 1581.1Scgd# prune quickly with one rm, then use find to clean up /tmp/[lq]* 1591.1Scgd# (not needed with mfs /tmp, but doesn't hurt there...) 1601.1Scgd(cd /tmp && rm -rf [a-km-pr-zA-Z]* && 1611.13Scgd find . ! -name . ! -name lost+found ! -name quotas \ 1621.13Scgd -exec rm -rf -- {} \; -type d -prune) 1631.1Scgd 1641.34Scgdif [ -f /var/account/acct ]; then 1651.34Scgd echo 'turning on accounting'; accton /var/account/acct 1661.34Scgdfi 1671.1Scgd 1681.1Scgdecho -n standard daemons: 1691.1Scgdecho -n ' update'; update 1701.31Sjtcecho -n ' cron'; cron 1711.1Scgdecho '.' 1721.1Scgd 1731.1Scgdecho -n starting network daemons: 1741.1Scgd 1751.19Scgd# $gated and $routed_flags are imported from /etc/netstart. 1761.1Scgd# If $gated == YES, gated is used; otherwise routed. 1771.19Scgd# If $routed_flags == NO, routed isn't run. 1781.1Scgdif [ X${gated} = X"YES" -a -r /etc/gated.conf ]; then 1791.19Scgd echo -n ' gated'; gated $gated_flags 1801.21Scgdelif [ "X${routed_flags}" != X"NO" ]; then 1811.19Scgd echo -n ' routed'; routed $routed_flags 1821.1Scgdfi 1831.1Scgd 1841.19Scgd# $name_server is imported from /etc/netstart; 1851.19Scgd# if $name_server == YES, named is run. 1861.1Scgdif [ X${name_server} = X"YES" -a -r /etc/named.boot ]; then 1871.1Scgd echo -n ' named'; named 1881.29Smycroftfi 1891.29Smycroft 1901.1Scgd# $rwhod is imported from /etc/netstart; 1911.2Scgd# if $rwhod == YES, rwhod is run. 1921.5Scgdif [ X${rwhod} = X"YES" ]; then 1931.1Scgd echo -n ' rwhod'; rwhod 1941.1Scgdfi 1951.1Scgd 1961.1Scgdecho -n ' printer'; lpd 1971.6Scgd 1981.19Scgd# $sendmail_flags is imported from /etc/netstart; 1991.24Scgd# If $sendmail_flags == NO or /etc/sendmail.cf doesn't exist, then 2001.24Scgd# sendmail isn't run. 2011.24Scgdif [ "X${sendmail_flags}" != X"NO" -a -r /etc/sendmail.cf ]; then 2021.19Scgd echo -n ' sendmail'; sendmail ${sendmail_flags} 2031.19Scgdfi 2041.19Scgd 2051.1Scgdecho -n ' inetd'; inetd 2061.30Smycroft 2071.30Smycroft# $rarpd_flags is importent from /etc/netstart; 2081.30Smycroft# If $rarpd_flags == NO or /etc/ethers doesn't exist, then 2091.30Smycroft# rarpd isn't run. 2101.30Smycroftif [ "X${rarpd_flags}" != X"NO" -a -r /etc/ethers ]; then 2111.30Smycroft echo -n ' rarpd'; rarpd ${rarpd_flags} 2121.30Smycroftfi 2131.30Smycroft 2141.30Smycroft# $bootparamd_flags is importent from /etc/netstart; 2151.30Smycroft# If $bootparamd_flags == NO or /etc/bootparams doesn't exist, then 2161.30Smycroft# bootparamd isn't run. 2171.30Smycroftif [ "X${bootparamd_flags}" != X"NO" -a -r /etc/bootparams ]; then 2181.30Smycroft echo -n ' rpc.bootparamd'; rpc.bootparamd ${bootparamd_flags} 2191.30Smycroftfi 2201.30Smycroft 2211.1Scgdecho '.' 2221.1Scgd 2231.25Smycroft. /etc/rc.local 2241.1Scgd 2251.1Scgddate 2261.1Scgd 2271.1Scgdexit 0 228