rc revision 1.1
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# yellow characters with blue background 101.1Scgdecho -n "[3;30x" 111.1Scgd 121.1Scgd# Set shell to ignore SIGINT (2), but not children; 131.1Scgd# shell catches SIGQUIT (3) and returns to single user after fsck. 141.1Scgdtrap : 2 151.1Scgdtrap : 3 # shouldn't be needed 161.1Scgd 171.1ScgdHOME=/; export HOME 181.1ScgdPATH=/sbin:/bin:/usr/sbin:/usr/bin 191.1Scgdexport PATH 201.1Scgd 211.1Scgdif [ -r /fastboot ] 221.1Scgdthen 231.1Scgd echo Fast boot ... skipping disk checks 241.1Scgdelif [ $1x = autobootx ] 251.1Scgdthen 261.1Scgd echo Automatic reboot in progress... 271.1Scgd fsck -p 281.1Scgd case $? in 291.1Scgd 0) 301.1Scgd ;; 311.1Scgd 2) 321.1Scgd exit 1 331.1Scgd ;; 341.1Scgd 4) 351.1Scgd reboot 361.1Scgd echo "reboot failed... help!" 371.1Scgd exit 1 381.1Scgd ;; 391.1Scgd 8) 401.1Scgd echo "Automatic file system check failed... help!" 411.1Scgd exit 1 421.1Scgd ;; 431.1Scgd 12) 441.1Scgd echo "Reboot 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.1Scgd echo "Unknown error in reboot" 531.1Scgd exit 1 541.1Scgd ;; 551.1Scgd esac 561.1Scgdfi 571.1Scgd 581.1Scgdtrap "echo 'Reboot 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.1Scgdmount -a -t nfs >/dev/null 2>&1 & # XXX shouldn't need background 711.1Scgd 721.1Scgd# clean up left-over files 731.1Scgdrm -f /etc/nologin 741.1Scgdrm -f /var/spool/uucp/LCK.* 751.1Scgdrm -f /var/spool/uucp/STST/* 761.1Scgd(cd /var/run && { rm -rf -- *; cp /dev/null utmp; chmod 644 utmp; }) 771.1Scgd 781.1Scgdecho -n 'starting system logger' 791.1Scgdrm -f /dev/log 801.1Scgdsyslogd 811.1Scgd 821.1Scgd# $timedflags is imported from /etc/netstart; 831.1Scgd# if $timedflags == NO, timed isn't run. 841.1Scgdif [ X${timedflags} != X"NO" ]; then 851.1Scgd echo -n ', time daemon'; timed $timedflags 861.1Scgdfi 871.1Scgdecho '.' 881.1Scgd 891.1Scgd# /var/crash should be a directory or a symbolic link 901.1Scgd# to the crash directory if core dumps are to be saved. 911.1Scgdif [ -d /var/crash ]; then 921.1Scgd echo checking for core dump... 931.1Scgd savecore /var/crash 941.1Scgdfi 951.1Scgd 961.1Scgd# echo -n 'checking quotas:' 971.1Scgd#quotacheck -a 981.1Scgd# echo ' done.' 991.1Scgd#quotaon -a 1001.1Scgd 1011.1Scgd# build ps databases 1021.1Scgdkvm_mkdb /386bsd 1031.1Scgddev_mkdb 1041.1Scgd 1051.1Scgdchmod 666 /dev/tty[pqrs]* 1061.1Scgd 1071.1Scgd# check the password temp/lock file 1081.1Scgdif [ -f /etc/ptmp ] 1091.1Scgdthen 1101.1Scgd logger -s -p auth.err \ 1111.1Scgd 'password file may be incorrect -- /etc/ptmp exists' 1121.1Scgdfi 1131.1Scgd 1141.1Scgdecho preserving editor files 1151.1Scgd(cd /var/tmp && /usr/libexec/elvispreserve "-the system rebooted" elvis* && 1161.1Scgd rm -f elvis[0-9a-f][0-9a-f][0-9a-f][0-9a-f]* \ 1171.1Scgd elvis_[0-9a-f][0-9a-f][0-9a-f][0-9a-f]*) 1181.1Scgd 1191.1Scgdecho clearing /tmp 1201.1Scgd 1211.1Scgd# prune quickly with one rm, then use find to clean up /tmp/[lq]* 1221.1Scgd# (not needed with mfs /tmp, but doesn't hurt there...) 1231.1Scgd(cd /tmp && rm -rf [a-km-pr-zA-Z]* && 1241.1Scgd find . ! -name . ! -name lost+found ! -name quotas -exec rm -rf -- {} \;) 1251.1Scgd 1261.1Scgd# 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.1Scgd# $gated and $routedflags are imported from /etc/netstart. 1361.1Scgd# If $gated == YES, gated is used; otherwise routed. 1371.1Scgd# If $routedflags == NO, routed isn't run. 1381.1Scgdif [ X${gated} = X"YES" -a -r /etc/gated.conf ]; then 1391.1Scgd echo -n ' gated'; gated $gatedflags 1401.1Scgdelif [ X${routedflags} != X"NO" ]; then 1411.1Scgd echo -n ' routed'; routed $routedflags 1421.1Scgdfi 1431.1Scgd 1441.1Scgdif [ X${name_server} = X"YES" -a -r /etc/named.boot ]; then 1451.1Scgd echo -n ' named'; named 1461.1Scgdfi 1471.1Scgd 1481.1Scgd# $rwhod is imported from /etc/netstart; 1491.1Scgd# if $rwhod is set to something other than NO, rwhod is run. 1501.1Scgdif [ ${rwhod-NO} != "NO" ]; then 1511.1Scgd echo -n ' rwhod'; rwhod 1521.1Scgdfi 1531.1Scgd 1541.1Scgdecho -n ' printer'; lpd 1551.1Scgd 1561.1Scgd 1571.1Scgdif [ X${nfs_server} = X"YES" -a -r /etc/exports ]; then 1581.1Scgd echo -n ' portmap'; portmap 1591.1Scgd echo -n ' mountd'; mountd 1601.1Scgd echo -n ' nfsd'; nfsd -u 0,0,4 -t 0,0 1611.1Scgd echo -n ' nfsiod'; nfsiod 4 1621.1Scgdfi 1631.1Scgd 1641.1Scgdecho -n ' sendmail'; sendmail -bd -q30m 1651.1Scgdecho -n ' inetd'; inetd 1661.1Scgdecho '.' 1671.1Scgd 1681.1Scgdsh /etc/rc.local 1691.1Scgd 1701.1Scgddate 1711.1Scgd 1721.1Scgd# reset to normal (no colors) 1731.1Scgdecho -n "[0x" 1741.1Scgdexit 0 175