[BACK]Return to rc CVS log [TXT][DIR] Up to [local] / src / etc

Annotation of src/etc/rc, Revision 1.241

1.241   ! cedric      1: #      $OpenBSD: rc,v 1.240 2004/03/22 04:34:42 mcbride Exp $
1.1       deraadt     2:
                      3: # System startup script run by init on autoboot
                      4: # or after single-user.
                      5: # Output and error are redirected to console by init,
                      6: # and the console is the controlling terminal.
                      7:
1.131     millert     8: # Subroutines (have to come first).
                      9:
                     10: # Strip comments (and leading/trailing whitespace if IFS is set)
                     11: # from a file and spew to stdout
                     12: stripcom() {
                     13:        local _file="$1"
                     14:        local _line
                     15:
                     16:        {
                     17:                while read _line ; do
                     18:                        _line=${_line%%#*}              # strip comments
                     19:                        test -z "$_line" && continue
                     20:                        echo $_line
                     21:                done
                     22:        } < $_file
                     23: }
                     24:
                     25: # End subroutines
                     26:
1.1       deraadt    27: stty status '^T'
                     28:
                     29: # Set shell to ignore SIGINT (2), but not children;
                     30: # shell catches SIGQUIT (3) and returns to single user after fsck.
                     31: trap : 2
                     32: trap : 3       # shouldn't be needed
                     33:
                     34: HOME=/; export HOME
                     35: PATH=/sbin:/bin:/usr/sbin:/usr/bin
                     36: export PATH
1.108     deraadt    37:
                     38: if [ $1x = shutdownx ]; then
                     39:        dd if=/dev/urandom of=/var/db/host.random bs=1024 count=64 >/dev/null 2>&1
                     40:        chmod 600 /var/db/host.random >/dev/null 2>&1
                     41:        if [ $? -eq 0 -a -f /etc/rc.shutdown ]; then
                     42:                echo /etc/rc.shutdown in progress...
                     43:                . /etc/rc.shutdown
                     44:                echo /etc/rc.shutdown complete.
                     45:                if [ "X${powerdown}" = X"YES" ]; then
                     46:                        exit 2
                     47:                fi
1.240     mcbride    48:
                     49:                # bring carp interfaces down gracefully
                     50:                for hn in /etc/hostname.carp[0-9]*; do
                     51:                        # Strip off /etc/hostname. prefix
                     52:                        if=${hn#/etc/hostname.}
1.241   ! cedric     53:                        test "$if" = "carp[0-9]*" && continue
1.240     mcbride    54:
                     55:                        ifconfig $if down
                     56:                done
1.108     deraadt    57:        else
                     58:                echo single user: not running /etc/rc.shutdown
                     59:        fi
                     60:        exit 0
                     61: fi
1.1       deraadt    62:
                     63: # Configure ccd devices.
1.17      deraadt    64: if [ -f /etc/ccd.conf ]; then
1.1       deraadt    65:        ccdconfig -C
                     66: fi
1.98      jakob      67:
                     68: # Configure raid devices.
                     69: for dev in 0 1 2 3; do
                     70:        if [ -f /etc/raid$dev.conf ]; then
                     71:                raidctl -c /etc/raid$dev.conf raid$dev
                     72:        fi
                     73: done
1.190     tdeval     74:
                     75: # Check parity on raid devices.
1.191     deraadt    76: raidctl -P all
1.1       deraadt    77:
1.172     miod       78: swapctl -A -t blk
1.170     deraadt    79:
1.17      deraadt    80: if [ -e /fastboot ]; then
1.1       deraadt    81:        echo "Fast boot: skipping disk checks."
1.17      deraadt    82: elif [ $1x = autobootx ]; then
1.1       deraadt    83:        echo "Automatic boot in progress: starting file system checks."
1.31      millert    84:        fsck -p
1.1       deraadt    85:        case $? in
                     86:        0)
                     87:                ;;
                     88:        2)
                     89:                exit 1
                     90:                ;;
                     91:        4)
                     92:                echo "Rebooting..."
                     93:                reboot
                     94:                echo "Reboot failed; help!"
                     95:                exit 1
                     96:                ;;
                     97:        8)
                     98:                echo "Automatic file system check failed; help!"
                     99:                exit 1
                    100:                ;;
                    101:        12)
                    102:                echo "Boot interrupted."
                    103:                exit 1
                    104:                ;;
                    105:        130)
                    106:                # interrupt before catcher installed
                    107:                exit 1
                    108:                ;;
                    109:        *)
                    110:                echo "Unknown error; help!"
                    111:                exit 1
                    112:                ;;
                    113:        esac
                    114: fi
                    115:
                    116: trap "echo 'Boot interrupted.'; exit 1" 3
                    117:
                    118: umount -a >/dev/null 2>&1
                    119: mount -a -t nonfs
1.57      niklas    120: mount -uw /            # root on nfs requires this, others aren't hurt
1.1       deraadt   121: rm -f /fastboot                # XXX (root now writeable)
1.177     deraadt   122:
                    123: # pick up option configuration
                    124: . /etc/rc.conf
1.1       deraadt   125:
                    126: # set flags on ttys.  (do early, in case they use tty for SLIP in netstart)
                    127: echo 'setting tty flags'
                    128: ttyflags -a
1.77      angelos   129:
1.186     deraadt   130: if [ "X${pf}" != X"NO" ]; then
1.211     mcbride   131:        RULES="block all"
1.228     henning   132:        RULES="$RULES\npass on lo0"
1.195     dhartmei  133:        RULES="$RULES\npass in proto tcp from any to any port 22 keep state"
1.208     camield   134:        RULES="$RULES\npass out proto { tcp, udp } from any to any port 53 keep state"
1.215     camield   135:        RULES="$RULES\npass out inet proto icmp all icmp-type echoreq keep state"
1.240     mcbride   136:        RULES="$RULES\npass proto { pfsync, carp }"
1.193     deraadt   137:        case `sysctl vfs.mounts.nfs 2>/dev/null` in
1.184     deraadt   138:        *[1-9]*)
                    139:                # don't kill NFS
1.218     cedric    140:                RULES="scrub in all no-df\n$RULES"
1.184     deraadt   141:                RULES="$RULES\npass in proto udp from any port { 111, 2049 } to any"
                    142:                RULES="$RULES\npass out proto udp from any to any port { 111, 2049 }"
                    143:                ;;
                    144:        esac
1.198     dhartmei  145:        echo $RULES | pfctl -f - -e
1.176     kjell     146: fi
                    147:
1.126     deraadt   148: if [ -f /etc/sysctl.conf ]; then
                    149: (
                    150:        # delete comments and blank lines
1.131     millert   151:        set -- `stripcom /etc/sysctl.conf`
1.126     deraadt   152:        while [ $# -ge 1 ] ; do
1.234     jmc       153:                sysctl $1
1.129     millert   154:                shift
1.126     deraadt   155:        done
                    156: )
                    157: fi
                    158:
1.1       deraadt   159: # set hostname, turn on network
                    160: echo 'starting network'
                    161: . /etc/netstart
1.176     kjell     162:
1.186     deraadt   163: if [ "X${pf}" != X"NO" ]; then
1.176     kjell     164:        if [ -f ${pf_rules} ]; then
1.198     dhartmei  165:                pfctl -f ${pf_rules}
1.176     kjell     166:        fi
                    167: fi
1.1       deraadt   168:
                    169: mount /usr >/dev/null 2>&1
                    170: mount /var >/dev/null 2>&1
1.180     deraadt   171:
1.149     deraadt   172: # if there's no /var/db/host.random, make one through /dev/urandom
                    173: if [ ! -f /var/db/host.random ]; then
                    174:        dd if=/dev/urandom of=/var/db/host.random bs=1024 count=64 \
                    175:                >/dev/null 2>&1
                    176:        chmod 600 /var/db/host.random >/dev/null 2>&1
                    177: else
                    178:        dd if=/var/db/host.random of=/dev/urandom bs=1024 count=64 \
                    179:            > /dev/null 2>&1
                    180:        dd if=/var/db/host.random of=/dev/arandom bs=1024 count=64 \
                    181:            > /dev/null 2>&1
                    182: fi
1.157     deraadt   183:
                    184: # reset seed file, so that if a shutdown-less reboot occurs,
                    185: # the next seed is not a repeat
                    186: dd if=/dev/urandom of=/var/db/host.random bs=1024 count=64 \
                    187:     > /dev/null 2>&1
1.29      deraadt   188:
1.55      deraadt   189: # clean up left-over files
                    190: rm -f /etc/nologin
                    191: rm -f /var/spool/lock/LCK.*
                    192: rm -f /var/spool/uucp/STST/*
1.192     millert   193: (cd /var/run && { test -r dhclient.pid && dhclient_pid=`cat dhclient.pid`; rm -rf -- *; install -c -m 664 -g utmp /dev/null utmp; test -n "$dhclient_pid" && echo "$dhclient_pid" > dhclient.pid; })
1.196     beck      194: (cd /var/authpf && rm -rf -- *)
                    195:
1.96      alex      196:
                    197: # save a copy of the boot messages
                    198: dmesg >/var/run/dmesg.boot
1.55      deraadt   199:
1.58      deraadt   200: echo 'starting system logger'
                    201: rm -f /dev/log
1.220     jakob     202: if [ "X${named_flags}" != X"NO" ]; then
                    203:        rm -f /var/named/dev/log
                    204:        syslogd_flags="${syslogd_flags} -a /var/named/dev/log"
1.216     millert   205: fi
                    206: if [ -d /var/empty ]; then
                    207:        rm -f /var/empty/dev/log
                    208:        mkdir -p -m 0555 /var/empty/dev
                    209:        syslogd_flags="${syslogd_flags} -a /var/empty/dev/log"
1.74      millert   210: fi
1.65      marc      211: syslogd ${syslogd_flags}
1.184     deraadt   212:
1.186     deraadt   213: if [ X"${pf}" != X"NO" -a X"${pflogd_flags}" != X"NO" ]; then
1.184     deraadt   214:        ifconfig pflog0 up
                    215:        pflogd ${pflogd_flags}
1.217     jakob     216: fi
                    217:
1.224     todd      218: # $named_flags is imported from /etc/rc.conf;
1.54      deraadt   219: # if $named_flags != NO, named is run.
                    220: if [ "X${named_flags}" != X"NO" ]; then
1.221     jakob     221:        if ! cmp -s /etc/rndc.key /var/named/etc/rndc.key ; then
                    222:                echo -n "rndc-confgen: generating new shared secret... "
                    223:                if /usr/sbin/rndc-confgen -a -t /var/named >/dev/null 2>&1; then
                    224:                        chmod 0640 /var/named/etc/rndc.key >/dev/null 2>&1
                    225:                        echo done.
                    226:                else
                    227:                        echo failed.
                    228:                fi
                    229:        fi
                    230:
1.58      deraadt   231:        echo 'starting named';          named $named_flags
1.94      deraadt   232: fi
                    233:
                    234: # $isakmpd_flags is imported from /etc/rc.conf;
1.185     angelos   235: # If $isakmpd_flags == NO or /etc/isakmpd/isakmpd.policy doesn't exist, then
1.94      deraadt   236: # isakmpd isn't run.
1.185     angelos   237: if [ "X${isakmpd_flags}" != X"NO" -a -e /etc/isakmpd/isakmpd.policy ]; then
1.94      deraadt   238:        echo 'starting isakmpd';        isakmpd ${isakmpd_flags}
1.40      provos    239: fi
1.1       deraadt   240:
                    241: echo -n 'starting rpc daemons:'
1.24      millert   242:
1.52      deraadt   243: # $portmap is imported from /etc/rc.conf;
1.24      millert   244: # if $portmap == YES, the portmapper is started.
                    245: if [ X"${portmap}" = X"YES" ]; then
1.23      deraadt   246:        echo -n ' portmap';             portmap
                    247: fi
1.1       deraadt   248:
1.174     deraadt   249: if [ -d /var/yp/binding -a X`domainname` != X ]; then
1.8       deraadt   250:        if [ -d /var/yp/`domainname` ]; then
                    251:                # yp server capabilities needed...
1.36      niklas    252:                echo -n ' ypserv';              ypserv ${ypserv_flags}
1.16      deraadt   253:                #echo -n ' ypxfrd';             ypxfrd
1.21      deraadt   254:        fi
                    255:
                    256:        echo -n ' ypbind';              ypbind
1.8       deraadt   257:
1.232     deraadt   258:        if [ X"${yppasswdd_flags}" != X"NO" -a -d /var/yp/`domainname` ]; then
1.8       deraadt   259:                # if we are the master server, run rpc.yppasswdd
                    260:                _host1=`ypwhich -m passwd 2> /dev/null`
                    261:                _host2=`hostname`
1.15      deraadt   262:                if [ `grep '^lookup' /etc/resolv.conf | grep yp | wc -c` -ne 0 ]; then
1.8       deraadt   263:                        _host1=`ypmatch $_host1 hosts | cut -d' ' -f2`
                    264:                        _host2=`ypmatch $_host2 hosts | cut -d' ' -f2 | head -1`
                    265:                else
                    266:                        _host1=`nslookup $_host1 | grep '^Name: ' | \
                    267:                            sed -e 's/^Name:    //'`
                    268:                        _host2=`nslookup $_host2 | grep '^Name: ' | \
                    269:                            sed -e 's/^Name:    //'`
                    270:                fi
1.13      deraadt   271:                if [ "$_host2" = "$_host1" ]; then
1.35      niklas    272:                        echo -n ' rpc.yppasswdd'
                    273:                        rpc.yppasswdd ${yppasswdd_flags}
1.8       deraadt   274:                fi
1.7       deraadt   275:        fi
1.1       deraadt   276: fi
                    277:
1.52      deraadt   278: # $nfs_server is imported from /etc/rc.conf;
1.1       deraadt   279: # if $nfs_server == YES, the machine is setup for being an nfs server
1.67      millert   280: if [ X${nfs_server} = X"YES" -a -s /etc/exports -a \
1.141     deraadt   281:     `sed -e '/^#/d' < /etc/exports | wc -l` -ne 0 ]; then
1.68      millert   282:        rm -f /var/db/mountdtab
1.1       deraadt   283:        echo -n > /var/db/mountdtab
                    284:        echo -n ' mountd';              mountd
1.42      niklas    285:        echo -n ' nfsd';                nfsd ${nfsd_flags}
                    286:        if [ X${lockd} = X"YES" ]; then
                    287:                echo -n ' rpc.lockd';   rpc.lockd
                    288:        fi
1.1       deraadt   289: fi
                    290:
1.165     deraadt   291: if [ X${amd} = X"YES" -a -e ${amd_master} ]; then
1.1       deraadt   292:        echo -n ' amd'
1.107     deraadt   293:        (cd /etc/amd; amd -l syslog -x error,noinfo,nostats -p \
                    294:            -a ${amd_dir} `cat ${amd_master}` > /var/run/amd.pid )
1.146     matt      295: fi
                    296:
                    297: # run rdate before timed
1.148     millert   298: if [ X"${rdate_flags}" != X"NO" ]; then
1.230     deraadt   299:        echo -n ' rdate';       rdate -s ${rdate_flags}
1.1       deraadt   300: fi
                    301:
1.52      deraadt   302: # $timed_flags is imported from /etc/rc.conf;
1.1       deraadt   303: # if $timed_flags == NO, timed isn't run.
                    304: if [ "X${timed_flags}" != X"NO" ]; then
1.58      deraadt   305:        echo -n ' timed'; timed $timed_flags
1.1       deraadt   306: fi
                    307: echo '.'
1.58      deraadt   308:
                    309: mount -a -t nfs
1.172     miod      310:
                    311: swapctl -A -t noblk
1.1       deraadt   312:
                    313: # /var/crash should be a directory or a symbolic link
                    314: # to the crash directory if core dumps are to be saved.
                    315: if [ -d /var/crash ]; then
1.188     tholo     316:        savecore ${savecore_flags} /var/crash
1.1       deraadt   317: fi
                    318:
1.233     beck      319: if [ "X${afs}" = X"YES" -a -c /dev/xfs0 ]; then
1.90      art       320:        echo -n 'mounting afs:'
1.233     beck      321:        mkdir -p -m 0755 /afs
                    322:        mount -t xfs /dev/xfs0 /afs
                    323:        /usr/libexec/afsd ${afsd_flags}
1.90      art       324:        echo ' done.'
                    325: fi
                    326:
1.41      downsj    327: if [ "X${check_quotas}" = X"YES" ]; then
                    328:        echo -n 'checking quotas:'
                    329:        quotacheck -a
                    330:        echo ' done.'
                    331:        quotaon -a
                    332: fi
1.1       deraadt   333:
                    334: # build ps databases
1.95      deraadt   335: echo -n 'building ps databases:'
                    336: echo -n " kvm"
1.88      millert   337: kvm_mkdb
1.95      deraadt   338: echo -n " dev"
1.1       deraadt   339: dev_mkdb
1.95      deraadt   340: echo "."
1.1       deraadt   341:
1.101     deraadt   342: chmod 666 /dev/tty[pqrstuvwxyzPQRST]*
1.226     millert   343: chown root:wheel /dev/tty[pqrstuvwxyzPQRST]*
1.1       deraadt   344:
                    345: # check the password temp/lock file
1.17      deraadt   346: if [ -f /etc/ptmp ]; then
1.1       deraadt   347:        logger -s -p auth.err \
                    348:        'password file may be incorrect -- /etc/ptmp exists'
1.32      deraadt   349: fi
                    350:
1.49      millert   351: echo clearing /tmp
                    352:
                    353: # prune quickly with one rm, then use find to clean up /tmp/[lq]*
                    354: # (not needed with mfs /tmp, but doesn't hurt there...)
                    355: (cd /tmp && rm -rf [a-km-pr-zA-Z]* &&
                    356:     find . ! -name . ! -name lost+found ! -name quota.user \
1.103     millert   357:        ! -name quota.group -execdir rm -rf -- {} \; -type d -prune)
1.49      millert   358:
1.203     hugh      359: # create Unix sockets directories  for X if needed and make sure they have
                    360: # correct permissions
1.210     henning   361: if [ -d /usr/X11R6/lib ]; then
1.203     hugh      362:        for d in /tmp/.X11-unix /tmp/.ICE-unix ; do
1.210     henning   363:                if [ -d $d ]; then
1.203     hugh      364:                        if [ `ls -ld $d | cut -d' ' -f4` != root ]; then
                    365:                                chown root $d
                    366:                        fi
                    367:                        if [ `ls -ld $d | cut -d' ' -f1` != drwxrwxrwt ]; then
                    368:                                chmod 1777 $d
                    369:                        fi
                    370:                elif [ -e $d ]; then
                    371:                        echo "Error: $d exists and isn't a directory."
                    372:                else
                    373:                        mkdir -m 1777 $d
                    374:                fi
                    375:        done
                    376: fi
                    377:
1.72      deraadt   378: [ -f /etc/rc.securelevel ] && . /etc/rc.securelevel
1.32      deraadt   379: if [ X${securelevel} != X"" ]; then
1.33      millert   380:        echo -n 'setting kernel security level: '
1.234     jmc       381:        sysctl kern.securelevel=${securelevel}
1.1       deraadt   382: fi
                    383:
1.34      deraadt   384: # patch /etc/motd
                    385: if [ ! -f /etc/motd ]; then
                    386:        install -c -o root -g wheel -m 664 /dev/null /etc/motd
                    387: fi
1.131     millert   388: T=`mktemp /tmp/_motd.XXXXXXXXXX`
1.105     millert   389: if [ $? -eq 0 ]; then
1.102     millert   390:        sysctl -n kern.version | sed 1q > $T
                    391:        echo "" >> $T
                    392:        sed '1,/^$/d' < /etc/motd >> $T
                    393:        cmp -s $T /etc/motd || cp $T /etc/motd
                    394:        rm -f $T
                    395: fi
1.34      deraadt   396:
1.1       deraadt   397: if [ -f /var/account/acct ]; then
                    398:        echo 'turning on accounting';   accton /var/account/acct
                    399: fi
                    400:
1.115     deraadt   401: if [ -f /sbin/ldconfig ]; then
                    402:        echo 'creating runtime link editor directory cache.'
                    403:        if [ -d /usr/local/lib ]; then
1.183     todd      404:                shlib_dirs="/usr/local/lib $shlib_dirs"
1.115     deraadt   405:        fi
                    406:        if [ -d /usr/X11R6/lib ]; then
1.183     todd      407:                shlib_dirs="/usr/X11R6/lib $shlib_dirs"
1.115     deraadt   408:        fi
                    409:        ldconfig $shlib_dirs
1.231     millert   410: fi
                    411:
                    412: if [ -x /usr/libexec/vi.recover ]; then
                    413:        echo 'preserving editor files'; /usr/libexec/vi.recover
1.115     deraadt   414: fi
                    415:
1.189     deraadt   416: if [ ! -f /etc/ssh/ssh_host_dsa_key ]; then
1.133     deraadt   417:        echo -n "ssh-keygen: generating new DSA host key... "
1.189     deraadt   418:        if /usr/bin/ssh-keygen -q -t dsa -f /etc/ssh/ssh_host_dsa_key -N ''; then
1.163     deraadt   419:                echo done.
                    420:        else
                    421:                echo failed.
                    422:        fi
                    423: fi
1.189     deraadt   424: if [ ! -f /etc/ssh/ssh_host_rsa_key ]; then
1.163     deraadt   425:        echo -n "ssh-keygen: generating new RSA host key... "
1.189     deraadt   426:        if /usr/bin/ssh-keygen -q -t rsa -f /etc/ssh/ssh_host_rsa_key -N ''; then
1.133     deraadt   427:                echo done.
                    428:        else
                    429:                echo failed.
                    430:        fi
                    431: fi
1.189     deraadt   432: if [ ! -f /etc/ssh/ssh_host_key ]; then
1.187     markus    433:        echo -n "ssh-keygen: generating new RSA1 host key... "
1.189     deraadt   434:        if /usr/bin/ssh-keygen -q -t rsa1 -f /etc/ssh/ssh_host_key -N ''; then
1.114     deraadt   435:                echo done.
                    436:        else
                    437:                echo failed.
                    438:        fi
                    439: fi
                    440:
1.1       deraadt   441: echo -n starting network daemons:
                    442:
1.227     ian       443: # $routed_flags are imported from /etc/rc.conf.
1.1       deraadt   444: # If $routed_flags == NO, routed isn't run.
1.227     ian       445: if [ "X${routed_flags}" != X"NO" ]; then
1.1       deraadt   446:        echo -n ' routed';              routed $routed_flags
                    447: fi
                    448:
1.52      deraadt   449: # $mrouted_flags is imported from /etc/rc.conf;
1.4       deraadt   450: # If $mrouted_flags == NO, then mrouted isn't run.
                    451: if [ "X${mrouted_flags}" != X"NO" ]; then
                    452:        echo -n ' mrouted';             mrouted $mrouted_flags
1.239     henning   453: fi
                    454:
                    455: if [ "X${bgpd_flags}" != X"NO" ]; then
                    456:        echo -n ' bgpd';                /usr/sbin/bgpd $bgpd_flags
1.4       deraadt   457: fi
1.1       deraadt   458:
1.86      form      459: # $dhcpd_flags is imported from /etc/rc.conf
                    460: # If $dhcpd_flags == NO or /etc/dhcpd.conf doesn't exist, then dhcpd isn't run.
                    461: if [ "X${dhcpd_flags}" != X"NO" -a -f /etc/dhcpd.conf ]; then
                    462:        touch /var/db/dhcpd.leases
                    463:        if [ -f /etc/dhcpd.interfaces ]; then
1.207     mpech     464:                dhcpd_ifs=`stripcom /etc/dhcpd.interfaces`
1.86      form      465:        fi
                    466:        echo -n ' dhcpd';       /usr/sbin/dhcpd ${dhcpd_flags} ${dhcpd_ifs}
1.127     itojun    467: fi
                    468:
                    469: if ifconfig lo0 inet6 >/dev/null 2>&1; then
                    470:        fw=`sysctl -n net.inet6.ip6.forwarding`
                    471:        if [ "X${fw}" == X"0" ]; then
                    472:                # $rtsold_flags is imported from /etc/rc.conf;
                    473:                # If $rtsold_flags == NO, then rtsold isn't run.
                    474:                if [ "X${rtsold_flags}" != X"NO" ]; then
                    475:                        echo -n ' rtsold'
                    476:                        /usr/sbin/rtsold ${rtsold_flags}
                    477:                fi
                    478:        else
                    479:                # $route6d_flags is imported from /etc/rc.conf;
                    480:                # If $route6d_flags == NO, then route6d isn't run.
                    481:                if [ "X${route6d_flags}" != X"NO" ]; then
                    482:                        echo -n ' route6d'
                    483:                        /usr/sbin/route6d ${route6d_flags}
                    484:                fi
                    485:                # $rtadvd_flags is imported from /etc/rc.conf;
1.147     itojun    486:                # If $rtadvd_flags == NO, then rtadvd isn't run.
                    487:                if [ "X${rtadvd_flags}" != X"NO" ]; then
1.127     itojun    488:                        echo -n ' rtadvd'
                    489:                        /usr/sbin/rtadvd ${rtadvd_flags}
                    490:                fi
                    491:        fi
1.86      form      492: fi
                    493:
1.52      deraadt   494: # $rwhod is imported from /etc/rc.conf;
1.1       deraadt   495: # if $rwhod == YES, rwhod is run.
                    496: if [ X${rwhod} = X"YES" ]; then
                    497:        echo -n ' rwhod';               rwhod
                    498: fi
                    499:
1.23      deraadt   500:
1.223     sturm     501: if [ "X${lpd_flags}" != X"NO" ]; then
1.173     fgsch     502:        echo -n ' printer';             lpd ${lpd_flags}
1.23      deraadt   503: fi
1.1       deraadt   504:
1.52      deraadt   505: # $sendmail_flags is imported from /etc/rc.conf;
1.154     millert   506: # If $sendmail_flags == NO or /etc/mailer.conf doesn't exist, then
1.6       deraadt   507: # sendmail isn't run.  We call sendmail with a full path so that
1.154     millert   508: # SIGHUP works.  Note that /usr/sbin/sendmail may actually call a
                    509: # mailer other than sendmail, depending on /etc/mailer.conf.
                    510: if [ "X${sendmail_flags}" != X"NO" -a -s /etc/mailer.conf ]; then
1.153     millert   511:        echo -n ' sendmail';            ( /usr/sbin/sendmail ${sendmail_flags} >/dev/null 2>&1 & )
1.212     deraadt   512: fi
                    513:
1.69      deraadt   514: if [ "X${httpd_flags}" != X"NO"  ]; then
1.143     espie     515:        # Clean up left-over httpd locks
                    516:        rm -f /var/www/logs/{ssl_mutex,httpd.lock,accept.lock}.*
1.160     angelos   517:        echo -n ' httpd';               /usr/sbin/httpd ${httpd_flags}
1.93      downsj    518: fi
                    519:
                    520: if [ "X${ftpd_flags}" != X"NO" ]; then
                    521:        echo -n ' ftpd';                /usr/libexec/ftpd ${ftpd_flags}
1.124     fgsch     522: fi
                    523:
                    524: if [ "X${identd_flags}" != X"NO" ]; then
                    525:        echo -n ' identd';              /usr/libexec/identd ${identd_flags}
1.1       deraadt   526: fi
                    527:
1.161     angelos   528: if [ X${inetd} = X"YES" -a -e /etc/inetd.conf ]; then
1.23      deraadt   529:        echo -n ' inetd';               inetd
1.237     deraadt   530: fi
                    531:
                    532: if [ X"${sshd_flags}" != X"NO" ]; then
                    533:        echo -n ' sshd';                /usr/sbin/sshd ${sshd_flags};
1.238     deraadt   534: fi
                    535:
                    536: if [ "X${spamd_flags}" != X"NO" ]; then
                    537:        if [ "X${spamd_grey}" != X"NO" ]; then
                    538:                spamd_flags="${spamd_flags} -g"
                    539:        fi
                    540:        echo -n ' spamd';               /usr/libexec/spamd ${spamd_flags}
                    541:        /usr/libexec/spamd-setup
                    542:        if [ "X${spamd_grey}" != X"NO" ]; then
                    543:                echo -n ' spamlogd'
                    544:                /usr/libexec/spamlogd
                    545:        fi
1.23      deraadt   546: fi
1.1       deraadt   547:
1.52      deraadt   548: # $rarpd_flags is imported from /etc/rc.conf;
1.1       deraadt   549: # If $rarpd_flags == NO or /etc/ethers doesn't exist, then
                    550: # rarpd isn't run.
1.67      millert   551: if [ "X${rarpd_flags}" != X"NO" -a -s /etc/ethers ]; then
1.1       deraadt   552:        echo -n ' rarpd';               rarpd ${rarpd_flags}
                    553: fi
                    554:
1.52      deraadt   555: # $bootparamd_flags is imported from /etc/rc.conf;
1.1       deraadt   556: # If $bootparamd_flags == NO or /etc/bootparams doesn't exist, then
                    557: # bootparamd isn't run.
1.67      millert   558: if [ "X${bootparamd_flags}" != X"NO" -a -s /etc/bootparams ]; then
1.1       deraadt   559:        echo -n ' rpc.bootparamd';      rpc.bootparamd ${bootparamd_flags}
                    560: fi
                    561:
1.52      deraadt   562: # $rbootd_flags is imported from /etc/rc.conf;
1.1       deraadt   563: # If $rbootd_flags == NO or /etc/rbootd.conf doesn't exist, then
                    564: # rbootd isn't run.
1.67      millert   565: if [ "X${rbootd_flags}" != X"NO" -a -s /etc/rbootd.conf ]; then
1.1       deraadt   566:        echo -n ' rbootd';              rbootd ${rbootd_flags}
1.56      maja      567: fi
                    568:
                    569: # $mopd_flags is imported from /etc/rc.conf;
                    570: # If $mopd_flags == NO or /tftpboot/mop doesn't exist, then
                    571: # mopd isn't run.
                    572: if [ "X${mopd_flags}" != X"NO" -a -d /tftpboot/mop ]; then
                    573:        echo -n ' mopd';                mopd ${mopd_flags}
1.1       deraadt   574: fi
                    575:
                    576: echo '.'
1.178     mickey    577:
1.214     marc      578: if [ -x /sbin/wsconsctl -a -f /etc/wsconsctl.conf ]; then
1.178     mickey    579: (
                    580:        # delete comments and blank lines
1.225     marc      581:        save_IFS="$IFS"
1.214     marc      582:        IFS="
                    583: "
1.178     mickey    584:        set -- `stripcom /etc/wsconsctl.conf`
1.225     marc      585:        IFS="$save_IFS"
1.178     mickey    586:        while [ $# -ge 1 ] ; do
1.214     marc      587:                eval /sbin/wsconsctl -w $1
1.178     mickey    588:                shift
                    589:        done
                    590: )
                    591: fi
1.1       deraadt   592:
1.12      deraadt   593: if [ -f /sbin/kbd -a -f /etc/kbdtype ]; then
                    594:        kbd `cat /etc/kbdtype`
1.175     hin       595: fi
                    596:
                    597: # KerberosV master KDC
                    598: if [ X${krb5_master_kdc} = X"YES" ]; then
                    599:        echo 'KerberosV master KDC'
                    600:        /usr/libexec/kdc &
                    601:        /usr/libexec/kadmind &
                    602:        /usr/libexec/kpasswdd &
                    603: fi
                    604:
                    605: # KerberosV slave KDC
                    606: if [ X${krb5_slave_kdc} = X"YES" ]; then
                    607:        echo 'KerberosV slave KDC'
                    608:        /usr/libexec/kdc &
                    609:        # Remember to enable hpropd in inetd.conf
1.17      deraadt   610: fi
                    611:
1.72      deraadt   612: [ -f /etc/rc.local ] && . /etc/rc.local
1.73      millert   613:
                    614: echo -n standard daemons:
1.87      marc      615:
                    616: # $apmd_flags is imported from /etc/rc.conf;
                    617: # don't run daemon if $apmd_flags == NO or /usr/sbin/apmd doesn't exist
                    618: if [ "X${apmd_flags}" != X"NO" -a -x /usr/sbin/apmd ]; then
1.230     deraadt   619:        echo -n ' apmd';        /usr/sbin/apmd ${apmd_flags}
1.229     henning   620: fi
                    621:
                    622: if [ X"${sensorsd_flags}" != X"NO" ]; then
                    623:        echo -n ' sensorsd';    /usr/sbin/sensorsd ${sensorsd_flags}
1.87      marc      624: fi
                    625:
1.73      millert   626: echo -n ' cron';               cron
1.87      marc      627:
1.73      millert   628: echo '.'
1.1       deraadt   629:
                    630: date
1.71      deraadt   631:
1.168     deraadt   632: if [ "X${wsmoused_flags}" != X"NO" -a -x /usr/sbin/wsmoused ]; then
1.169     deraadt   633:        echo 'starting wsmoused...';    /usr/sbin/wsmoused ${wsmoused_flags}
1.155     aaron     634: fi
                    635:
1.71      deraadt   636: # Alternatively, on some architectures, xdm may be started in /etc/ttys.
                    637: if [ "X${xdm_flags}" != X"NO" ]; then
1.92      downsj    638:        echo 'starting xdm...';         /usr/X11R6/bin/xdm ${xdm_flags}
1.71      deraadt   639: fi
                    640:
1.1       deraadt   641: exit 0
1.90      art       642: