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

Annotation of src/etc/rc, Revision 1.215

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