rc revision 1.23
11.1Scgd# @(#)rc 5.27 (Berkeley) 6/5/91 21.1Scgd 31.1Scgd# System startup script run by init on autoboot 41.1Scgd# or after single-user. 51.1Scgd# Output and error are redirected to console by init, 61.1Scgd# and the console is the controlling terminal. 71.1Scgd 81.1Scgdstty status '^T' 91.1Scgd 101.1Scgd# Set shell to ignore SIGINT (2), but not children; 111.1Scgd# shell catches SIGQUIT (3) and returns to single user after fsck. 121.1Scgdtrap : 2 131.1Scgdtrap : 3 # shouldn't be needed 141.1Scgd 151.1ScgdHOME=/; export HOME 161.1ScgdPATH=/sbin:/bin:/usr/sbin:/usr/bin 171.1Scgdexport PATH 181.1Scgd 191.17Smycroftif [ -e /fastboot ] 201.1Scgdthen 211.1Scgd echo Fast boot ... skipping disk checks 221.1Scgdelif [ $1x = autobootx ] 231.1Scgdthen 241.1Scgd echo Automatic reboot in progress... 251.1Scgd fsck -p 261.1Scgd case $? in 271.1Scgd 0) 281.1Scgd ;; 291.1Scgd 2) 301.1Scgd exit 1 311.1Scgd ;; 321.1Scgd 4) 331.1Scgd reboot 341.1Scgd echo "reboot failed... help!" 351.1Scgd exit 1 361.1Scgd ;; 371.1Scgd 8) 381.1Scgd echo "Automatic file system check failed... help!" 391.1Scgd exit 1 401.1Scgd ;; 411.1Scgd 12) 421.1Scgd echo "Reboot interrupted" 431.1Scgd exit 1 441.1Scgd ;; 451.1Scgd 130) 461.1Scgd # interrupt before catcher installed 471.1Scgd exit 1 481.1Scgd ;; 491.1Scgd *) 501.1Scgd echo "Unknown error in reboot" 511.1Scgd exit 1 521.1Scgd ;; 531.1Scgd esac 541.1Scgdfi 551.1Scgd 561.1Scgdtrap "echo 'Reboot interrupted'; exit 1" 3 571.1Scgd 581.1Scgdswapon -a 591.1Scgd 601.1Scgdumount -a >/dev/null 2>&1 611.1Scgdmount -a -t nonfs 621.1Scgdrm -f /fastboot # XXX (root now writeable) 631.1Scgd 641.1Scgd# set hostname, turn on network 651.1Scgdecho 'starting network' 661.1Scgd. /etc/netstart 671.1Scgd 681.1Scgdmount -a -t nfs >/dev/null 2>&1 & # XXX shouldn't need background 691.1Scgd 701.1Scgd# clean up left-over files 711.1Scgdrm -f /etc/nologin 721.1Scgdrm -f /var/spool/uucp/LCK.* 731.1Scgdrm -f /var/spool/uucp/STST/* 741.1Scgd(cd /var/run && { rm -rf -- *; cp /dev/null utmp; chmod 644 utmp; }) 751.23Smycroft 761.23Smycroftecho 'runtime link editor directory cache' 771.23Smycroftrm -f /var/run/ld.so.hints 781.23Smycroftldconfig 791.1Scgd 801.1Scgdecho -n 'starting system logger' 811.1Scgdrm -f /dev/log 821.1Scgdsyslogd 831.1Scgd 841.19Scgd# $timed_flags is imported from /etc/netstart; 851.19Scgd# if $timed_flags == NO, timed isn't run. 861.21Scgdif [ "X${timed_flags}" != X"NO" ]; then 871.19Scgd echo -n ', time daemon'; timed $timed_flags 881.1Scgdfi 891.1Scgdecho '.' 901.1Scgd 911.1Scgd# /var/crash should be a directory or a symbolic link 921.1Scgd# to the crash directory if core dumps are to be saved. 931.1Scgdif [ -d /var/crash ]; then 941.1Scgd echo checking for core dump... 951.1Scgd savecore /var/crash 961.1Scgdfi 971.1Scgd 981.1Scgd# echo -n 'checking quotas:' 991.1Scgd#quotacheck -a 1001.1Scgd# echo ' done.' 1011.1Scgd#quotaon -a 1021.1Scgd 1031.1Scgd# build ps databases 1041.2Scgdecho 'building databases...' 1051.11Scgdkvm_mkdb /netbsd 1061.1Scgddev_mkdb 1071.1Scgd 1081.1Scgdchmod 666 /dev/tty[pqrs]* 1091.1Scgd 1101.1Scgd# check the password temp/lock file 1111.1Scgdif [ -f /etc/ptmp ] 1121.1Scgdthen 1131.1Scgd logger -s -p auth.err \ 1141.1Scgd 'password file may be incorrect -- /etc/ptmp exists' 1151.1Scgdfi 1161.1Scgd 1171.1Scgdecho preserving editor files 1181.1Scgd(cd /var/tmp && /usr/libexec/elvispreserve "-the system rebooted" elvis* && 1191.1Scgd rm -f elvis[0-9a-f][0-9a-f][0-9a-f][0-9a-f]* \ 1201.1Scgd elvis_[0-9a-f][0-9a-f][0-9a-f][0-9a-f]*) 1211.1Scgd 1221.1Scgdecho clearing /tmp 1231.1Scgd 1241.1Scgd# prune quickly with one rm, then use find to clean up /tmp/[lq]* 1251.1Scgd# (not needed with mfs /tmp, but doesn't hurt there...) 1261.1Scgd(cd /tmp && rm -rf [a-km-pr-zA-Z]* && 1271.13Scgd find . ! -name . ! -name lost+found ! -name quotas \ 1281.13Scgd -exec rm -rf -- {} \; -type d -prune) 1291.1Scgd 1301.18Scgd#echo 'turning on accounting'; accton /var/account/acct 1311.1Scgd 1321.1Scgdecho -n standard daemons: 1331.1Scgdecho -n ' update'; update 1341.1Scgdecho -n ' crond'; /usr/libexec/crond 1351.1Scgdecho '.' 1361.1Scgd 1371.1Scgdecho -n starting network daemons: 1381.1Scgd 1391.19Scgd# $gated and $routed_flags are imported from /etc/netstart. 1401.1Scgd# If $gated == YES, gated is used; otherwise routed. 1411.19Scgd# If $routed_flags == NO, routed isn't run. 1421.1Scgdif [ X${gated} = X"YES" -a -r /etc/gated.conf ]; then 1431.19Scgd echo -n ' gated'; gated $gated_flags 1441.21Scgdelif [ "X${routed_flags}" != X"NO" ]; then 1451.19Scgd echo -n ' routed'; routed $routed_flags 1461.1Scgdfi 1471.1Scgd 1481.19Scgd# $name_server is imported from /etc/netstart; 1491.19Scgd# if $name_server == YES, named is run. 1501.1Scgdif [ X${name_server} = X"YES" -a -r /etc/named.boot ]; then 1511.1Scgd echo -n ' named'; named 1521.1Scgdfi 1531.1Scgd 1541.1Scgd# $rwhod is imported from /etc/netstart; 1551.2Scgd# if $rwhod == YES, rwhod is run. 1561.5Scgdif [ X${rwhod} = X"YES" ]; then 1571.1Scgd echo -n ' rwhod'; rwhod 1581.1Scgdfi 1591.1Scgd 1601.1Scgdecho -n ' printer'; lpd 1611.1Scgd 1621.8Scgdecho -n ' portmap'; portmap 1631.7Sglass 1641.19Scgd# $nfs_server is imported from /etc/netstart; 1651.9Sglass# if $nfs_server == YES, the machine is setup for being an nfs server 1661.1Scgdif [ X${nfs_server} = X"YES" -a -r /etc/exports ]; then 1671.7Sglass rm -f /var/db/mountdtab 1681.16Sderaadt echo -n ' mountd'; mountd 1691.1Scgd echo -n ' nfsd'; nfsd -u 0,0,4 -t 0,0 1701.9Sglassfi 1711.9Sglass 1721.19Scgd# $nfs_client is imported from /etc/netstart; 1731.9Sglass# if $nfs_client == YES, the machine is setup for being an nfs client 1741.9Sglassif [ X${nfs_client} = X"YES" ]; then 1751.1Scgd echo -n ' nfsiod'; nfsiod 4 1761.1Scgdfi 1771.6Scgd 1781.19Scgd# $sendmail_flags is imported from /etc/netstart; 1791.19Scgd# If $sendmail_flags == NO, routed isn't run. 1801.20Scgdif [ "X${sendmail_flags}" != X"NO" ]; then 1811.19Scgd echo -n ' sendmail'; sendmail ${sendmail_flags} 1821.19Scgdfi 1831.19Scgd 1841.1Scgdecho -n ' inetd'; inetd 1851.1Scgdecho '.' 1861.1Scgd 1871.1Scgdsh /etc/rc.local 1881.1Scgd 1891.1Scgddate 1901.1Scgd 1911.1Scgdexit 0 192