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

Annotation of src/etc/rc, Revision 1.36

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

CVSweb <webmaster@jp.NetBSD.org>