rc revision 1.19
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.1Scgd 761.1Scgdecho -n 'starting system logger' 771.1Scgdrm -f /dev/log 781.1Scgdsyslogd 791.1Scgd 801.19Scgd# $timed_flags is imported from /etc/netstart; 811.19Scgd# if $timed_flags == NO, timed isn't run. 821.19Scgdif [ X${timed_flags} != X"NO" ]; then 831.19Scgd echo -n ', time daemon'; timed $timed_flags 841.1Scgdfi 851.1Scgdecho '.' 861.1Scgd 871.1Scgd# /var/crash should be a directory or a symbolic link 881.1Scgd# to the crash directory if core dumps are to be saved. 891.1Scgdif [ -d /var/crash ]; then 901.1Scgd echo checking for core dump... 911.1Scgd savecore /var/crash 921.1Scgdfi 931.1Scgd 941.1Scgd# echo -n 'checking quotas:' 951.1Scgd#quotacheck -a 961.1Scgd# echo ' done.' 971.1Scgd#quotaon -a 981.1Scgd 991.1Scgd# build ps databases 1001.2Scgdecho 'building databases...' 1011.11Scgdkvm_mkdb /netbsd 1021.1Scgddev_mkdb 1031.1Scgd 1041.1Scgdchmod 666 /dev/tty[pqrs]* 1051.1Scgd 1061.1Scgd# check the password temp/lock file 1071.1Scgdif [ -f /etc/ptmp ] 1081.1Scgdthen 1091.1Scgd logger -s -p auth.err \ 1101.1Scgd 'password file may be incorrect -- /etc/ptmp exists' 1111.1Scgdfi 1121.1Scgd 1131.1Scgdecho preserving editor files 1141.1Scgd(cd /var/tmp && /usr/libexec/elvispreserve "-the system rebooted" elvis* && 1151.1Scgd rm -f elvis[0-9a-f][0-9a-f][0-9a-f][0-9a-f]* \ 1161.1Scgd elvis_[0-9a-f][0-9a-f][0-9a-f][0-9a-f]*) 1171.1Scgd 1181.1Scgdecho clearing /tmp 1191.1Scgd 1201.1Scgd# prune quickly with one rm, then use find to clean up /tmp/[lq]* 1211.1Scgd# (not needed with mfs /tmp, but doesn't hurt there...) 1221.1Scgd(cd /tmp && rm -rf [a-km-pr-zA-Z]* && 1231.13Scgd find . ! -name . ! -name lost+found ! -name quotas \ 1241.13Scgd -exec rm -rf -- {} \; -type d -prune) 1251.1Scgd 1261.18Scgd#echo 'turning on accounting'; accton /var/account/acct 1271.1Scgd 1281.1Scgdecho -n standard daemons: 1291.1Scgdecho -n ' update'; update 1301.1Scgdecho -n ' crond'; /usr/libexec/crond 1311.1Scgdecho '.' 1321.1Scgd 1331.1Scgdecho -n starting network daemons: 1341.1Scgd 1351.19Scgd# $gated and $routed_flags are imported from /etc/netstart. 1361.1Scgd# If $gated == YES, gated is used; otherwise routed. 1371.19Scgd# If $routed_flags == NO, routed isn't run. 1381.1Scgdif [ X${gated} = X"YES" -a -r /etc/gated.conf ]; then 1391.19Scgd echo -n ' gated'; gated $gated_flags 1401.19Scgdelif [ X${routed_flags} != X"NO" ]; then 1411.19Scgd echo -n ' routed'; routed $routed_flags 1421.1Scgdfi 1431.1Scgd 1441.19Scgd# $name_server is imported from /etc/netstart; 1451.19Scgd# if $name_server == YES, named is run. 1461.1Scgdif [ X${name_server} = X"YES" -a -r /etc/named.boot ]; then 1471.1Scgd echo -n ' named'; named 1481.1Scgdfi 1491.1Scgd 1501.1Scgd# $rwhod is imported from /etc/netstart; 1511.2Scgd# if $rwhod == YES, rwhod is run. 1521.5Scgdif [ X${rwhod} = X"YES" ]; then 1531.1Scgd echo -n ' rwhod'; rwhod 1541.1Scgdfi 1551.1Scgd 1561.1Scgdecho -n ' printer'; lpd 1571.1Scgd 1581.8Scgdecho -n ' portmap'; portmap 1591.7Sglass 1601.19Scgd# $nfs_server is imported from /etc/netstart; 1611.9Sglass# if $nfs_server == YES, the machine is setup for being an nfs server 1621.1Scgdif [ X${nfs_server} = X"YES" -a -r /etc/exports ]; then 1631.7Sglass rm -f /var/db/mountdtab 1641.16Sderaadt echo -n ' mountd'; mountd 1651.1Scgd echo -n ' nfsd'; nfsd -u 0,0,4 -t 0,0 1661.9Sglassfi 1671.9Sglass 1681.19Scgd# $nfs_client is imported from /etc/netstart; 1691.9Sglass# if $nfs_client == YES, the machine is setup for being an nfs client 1701.9Sglassif [ X${nfs_client} = X"YES" ]; then 1711.1Scgd echo -n ' nfsiod'; nfsiod 4 1721.1Scgdfi 1731.6Scgd 1741.19Scgd# $sendmail_flags is imported from /etc/netstart; 1751.19Scgd# If $sendmail_flags == NO, routed isn't run. 1761.19Scgdif [ X${sendmail_flags} != X"NO" ]; then 1771.19Scgd echo -n ' sendmail'; sendmail ${sendmail_flags} 1781.19Scgdfi 1791.19Scgd 1801.1Scgdecho -n ' inetd'; inetd 1811.1Scgdecho '.' 1821.1Scgd 1831.1Scgdsh /etc/rc.local 1841.1Scgd 1851.1Scgddate 1861.1Scgd 1871.1Scgdexit 0 188