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

Annotation of src/etc/rc, Revision 1.222

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