[BACK]Return to rc CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / etc

Annotation of src/etc/rc, Revision 1.28

1.26      deraadt     1: #      @(#)rc  5.27 (Berkeley) 6/5/91
1.28    ! jtc         2: #      $Id: rc,v 1.27 1994/01/05 06:34:56 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
                     22:        echo Fast boot ... skipping disk checks
                     23: elif [ $1x = autobootx ]
                     24: then
                     25:        echo Automatic reboot in progress...
                     26:        fsck -p
                     27:        case $? in
                     28:        0)
                     29:                ;;
                     30:        2)
                     31:                exit 1
                     32:                ;;
                     33:        4)
                     34:                reboot
                     35:                echo "reboot failed... help!"
                     36:                exit 1
                     37:                ;;
                     38:        8)
                     39:                echo "Automatic file system check failed... help!"
                     40:                exit 1
                     41:                ;;
                     42:        12)
                     43:                echo "Reboot interrupted"
                     44:                exit 1
                     45:                ;;
                     46:        130)
                     47:                # interrupt before catcher installed
                     48:                exit 1
                     49:                ;;
                     50:        *)
                     51:                echo "Unknown error in reboot"
                     52:                exit 1
                     53:                ;;
                     54:        esac
                     55: fi
                     56:
                     57: trap "echo 'Reboot interrupted'; exit 1" 3
                     58:
                     59: swapon -a
                     60:
                     61: umount -a >/dev/null 2>&1
                     62: mount -a -t nonfs
                     63: rm -f /fastboot                # XXX (root now writeable)
                     64:
                     65: # set hostname, turn on network
                     66: echo 'starting network'
                     67: . /etc/netstart
                     68:
1.26      deraadt    69: mount /usr >/dev/null 2>&1
                     70:
                     71: echo -n 'starting rpc daemons:'
                     72: echo -n ' portmap';            portmap
                     73:
                     74: if [ -f /usr/sbin/ypbind -a -d /var/yp ]; then
                     75:        echo -n ' ypbind';              ypbind
                     76: fi
                     77:
                     78: # $nfs_server is imported from /etc/netstart;
                     79: # if $nfs_server == YES, the machine is setup for being an nfs server
                     80: if [ X${nfs_server} = X"YES" -a -r /etc/exports ]; then
                     81:        rm -f /var/db/mountdtab
                     82:        echo -n ' mountd';              mountd
                     83:        echo -n ' nfsd';                nfsd -u 0,0,4 -t 0,0
                     84: fi
                     85:
                     86: # $nfs_client is imported from /etc/netstart;
                     87: # if $nfs_client == YES, the machine is setup for being an nfs client
                     88: if [ X${nfs_client} = X"YES" ]; then
                     89:        echo -n ' nfsiod';              nfsiod 4
                     90: fi
                     91:
1.27      deraadt    92: if [ X${amd} = X"YES" ]; then
                     93:        echo -n ' amd'
                     94:        amd -x error,noinfo,nostats -a /tmp_mnt /home amd.home
                     95: fi
                     96:
1.26      deraadt    97: echo '.'
1.27      deraadt    98: mount -a -t nfs
1.1       cgd        99:
                    100: # clean up left-over files
                    101: rm -f /etc/nologin
                    102: rm -f /var/spool/uucp/LCK.*
                    103: rm -f /var/spool/uucp/STST/*
                    104: (cd /var/run && { rm -rf -- *; cp /dev/null utmp; chmod 644 utmp; })
1.23      mycroft   105:
                    106: echo 'runtime link editor directory cache'
                    107: rm -f /var/run/ld.so.hints
                    108: ldconfig
1.1       cgd       109:
                    110: echo -n 'starting system logger'
                    111: rm -f /dev/log
                    112: syslogd
                    113:
1.19      cgd       114: # $timed_flags is imported from /etc/netstart;
                    115: # if $timed_flags == NO, timed isn't run.
1.21      cgd       116: if [ "X${timed_flags}" != X"NO" ]; then
1.19      cgd       117:        echo -n ', time daemon'; timed $timed_flags
1.1       cgd       118: fi
                    119: echo '.'
                    120:
                    121: # /var/crash should be a directory or a symbolic link
                    122: # to the crash directory if core dumps are to be saved.
                    123: if [ -d /var/crash ]; then
                    124:        echo checking for core dump...
                    125:        savecore /var/crash
                    126: fi
                    127:
                    128: #                              echo -n 'checking quotas:'
                    129: #quotacheck -a
                    130: #                              echo ' done.'
                    131: #quotaon -a
                    132:
                    133: # build ps databases
1.2       cgd       134: echo 'building databases...'
1.11      cgd       135: kvm_mkdb /netbsd
1.1       cgd       136: dev_mkdb
                    137:
                    138: chmod 666 /dev/tty[pqrs]*
                    139:
                    140: # check the password temp/lock file
                    141: if [ -f /etc/ptmp ]
                    142: then
                    143:        logger -s -p auth.err \
                    144:        'password file may be incorrect -- /etc/ptmp exists'
                    145: fi
                    146:
                    147: echo preserving editor files
                    148: (cd /var/tmp && /usr/libexec/elvispreserve "-the system rebooted" elvis* &&
                    149:      rm -f elvis[0-9a-f][0-9a-f][0-9a-f][0-9a-f]* \
                    150:         elvis_[0-9a-f][0-9a-f][0-9a-f][0-9a-f]*)
                    151:
                    152: echo clearing /tmp
                    153:
                    154: # prune quickly with one rm, then use find to clean up /tmp/[lq]*
                    155: # (not needed with mfs /tmp, but doesn't hurt there...)
                    156: (cd /tmp && rm -rf [a-km-pr-zA-Z]* &&
1.13      cgd       157:     find . ! -name . ! -name lost+found ! -name quotas \
                    158:        -exec rm -rf -- {} \; -type d -prune)
1.1       cgd       159:
1.18      cgd       160: #echo 'turning on accounting'; accton /var/account/acct
1.1       cgd       161:
                    162: echo -n standard daemons:
                    163: echo -n ' update';             update
1.28    ! jtc       164: echo -n ' cron';               /usr/libexec/cron
1.1       cgd       165: echo '.'
                    166:
                    167: echo -n starting network daemons:
                    168:
1.19      cgd       169: # $gated and $routed_flags are imported from /etc/netstart.
1.1       cgd       170: # If $gated == YES, gated is used; otherwise routed.
1.19      cgd       171: # If $routed_flags == NO, routed isn't run.
1.1       cgd       172: if [ X${gated} = X"YES" -a -r /etc/gated.conf ]; then
1.19      cgd       173:        echo -n ' gated';       gated $gated_flags
1.21      cgd       174: elif [ "X${routed_flags}" != X"NO" ]; then
1.19      cgd       175:        echo -n ' routed';      routed $routed_flags
1.1       cgd       176: fi
                    177:
1.19      cgd       178: # $name_server is imported from /etc/netstart;
                    179: # if $name_server == YES, named is run.
1.1       cgd       180: if [ X${name_server} = X"YES" -a -r /etc/named.boot ]; then
                    181:        echo -n ' named';               named
                    182: fi
                    183:
                    184: # $rwhod is imported from /etc/netstart;
1.2       cgd       185: # if $rwhod == YES, rwhod is run.
1.5       cgd       186: if [ X${rwhod} = X"YES" ]; then
1.1       cgd       187:        echo -n ' rwhod';       rwhod
                    188: fi
                    189:
                    190: echo -n ' printer';            lpd
1.6       cgd       191:
1.19      cgd       192: # $sendmail_flags is imported from /etc/netstart;
1.24      cgd       193: # If $sendmail_flags == NO or /etc/sendmail.cf doesn't exist, then
                    194: # sendmail isn't run.
                    195: if [ "X${sendmail_flags}" != X"NO" -a -r /etc/sendmail.cf ]; then
1.19      cgd       196:        echo -n ' sendmail';            sendmail ${sendmail_flags}
                    197: fi
                    198:
1.1       cgd       199: echo -n ' inetd';              inetd
                    200: echo '.'
                    201:
1.25      mycroft   202: . /etc/rc.local
1.1       cgd       203:
                    204: date
                    205:
                    206: exit 0

CVSweb <webmaster@jp.NetBSD.org>