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