Annotation of src/etc/rc, Revision 1.279
1.279 ! deraadt 1: # $OpenBSD: rc,v 1.278 2006/03/12 20:07:48 otto 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.279 ! deraadt 216: wsconsctl_conf
! 217:
1.266 millert 218: if [ X"${pf}" != X"NO" ]; then
1.211 mcbride 219: RULES="block all"
1.228 henning 220: RULES="$RULES\npass on lo0"
1.195 dhartmei 221: RULES="$RULES\npass in proto tcp from any to any port 22 keep state"
1.208 camield 222: RULES="$RULES\npass out proto { tcp, udp } from any to any port 53 keep state"
1.215 camield 223: RULES="$RULES\npass out inet proto icmp all icmp-type echoreq keep state"
1.257 grange 224: if ifconfig lo0 inet6 >/dev/null 2>&1; then
1.258 itojun 225: RULES="$RULES\npass out inet6 proto icmp6 all icmp6-type neighbrsol"
226: RULES="$RULES\npass in inet6 proto icmp6 all icmp6-type neighbradv"
1.257 grange 227: RULES="$RULES\npass out inet6 proto icmp6 all icmp6-type routersol"
228: RULES="$RULES\npass in inet6 proto icmp6 all icmp6-type routeradv"
229: fi
1.240 mcbride 230: RULES="$RULES\npass proto { pfsync, carp }"
1.193 deraadt 231: case `sysctl vfs.mounts.nfs 2>/dev/null` in
1.184 deraadt 232: *[1-9]*)
233: # don't kill NFS
1.218 cedric 234: RULES="scrub in all no-df\n$RULES"
1.184 deraadt 235: RULES="$RULES\npass in proto udp from any port { 111, 2049 } to any"
236: RULES="$RULES\npass out proto udp from any to any port { 111, 2049 }"
237: ;;
238: esac
1.269 dhartmei 239: echo $RULES | pfctl -f -
240: pfctl -e
1.176 kjell 241: fi
242:
1.267 millert 243: sysctl_conf
1.260 jsg 244:
1.1 deraadt 245: # set hostname, turn on network
246: echo 'starting network'
1.264 deraadt 247: if [ -f /etc/resolv.conf.save ]; then
248: mv /etc/resolv.conf.save /etc/resolv.conf
249: touch /etc/resolv.conf
250: fi
1.1 deraadt 251: . /etc/netstart
1.176 kjell 252:
1.266 millert 253: if [ X"${pf}" != X"NO" ]; then
1.176 kjell 254: if [ -f ${pf_rules} ]; then
1.198 dhartmei 255: pfctl -f ${pf_rules}
1.176 kjell 256: fi
257: fi
1.1 deraadt 258:
1.278 otto 259: mount -s /usr >/dev/null 2>&1
260: mount -s /var >/dev/null 2>&1
1.180 deraadt 261:
1.149 deraadt 262: # if there's no /var/db/host.random, make one through /dev/urandom
263: if [ ! -f /var/db/host.random ]; then
264: dd if=/dev/urandom of=/var/db/host.random bs=1024 count=64 \
265: >/dev/null 2>&1
266: chmod 600 /var/db/host.random >/dev/null 2>&1
267: else
268: dd if=/var/db/host.random of=/dev/urandom bs=1024 count=64 \
269: > /dev/null 2>&1
270: dd if=/var/db/host.random of=/dev/arandom bs=1024 count=64 \
271: > /dev/null 2>&1
272: fi
1.157 deraadt 273:
274: # reset seed file, so that if a shutdown-less reboot occurs,
275: # the next seed is not a repeat
276: dd if=/dev/urandom of=/var/db/host.random bs=1024 count=64 \
277: > /dev/null 2>&1
1.29 deraadt 278:
1.55 deraadt 279: # clean up left-over files
280: rm -f /etc/nologin
281: rm -f /var/spool/lock/LCK.*
282: rm -f /var/spool/uucp/STST/*
1.247 henning 283: (cd /var/run && { rm -rf -- *; install -c -m 664 -g utmp /dev/null utmp; })
1.196 beck 284: (cd /var/authpf && rm -rf -- *)
1.96 alex 285:
286: # save a copy of the boot messages
287: dmesg >/var/run/dmesg.boot
1.55 deraadt 288:
1.58 deraadt 289: echo 'starting system logger'
290: rm -f /dev/log
1.266 millert 291: if [ X"${named_flags}" != X"NO" ]; then
1.220 jakob 292: rm -f /var/named/dev/log
293: syslogd_flags="${syslogd_flags} -a /var/named/dev/log"
1.216 millert 294: fi
295: if [ -d /var/empty ]; then
296: rm -f /var/empty/dev/log
297: mkdir -p -m 0555 /var/empty/dev
298: syslogd_flags="${syslogd_flags} -a /var/empty/dev/log"
1.74 millert 299: fi
1.65 marc 300: syslogd ${syslogd_flags}
1.184 deraadt 301:
1.186 deraadt 302: if [ X"${pf}" != X"NO" -a X"${pflogd_flags}" != X"NO" ]; then
1.261 millert 303: if ifconfig pflog0 >/dev/null 2>&1; then
304: ifconfig pflog0 up
305: pflogd ${pflogd_flags}
306: fi
1.217 jakob 307: fi
308:
1.224 todd 309: # $named_flags is imported from /etc/rc.conf;
1.54 deraadt 310: # if $named_flags != NO, named is run.
1.266 millert 311: if [ X"${named_flags}" != X"NO" ]; then
1.221 jakob 312: if ! cmp -s /etc/rndc.key /var/named/etc/rndc.key ; then
313: echo -n "rndc-confgen: generating new shared secret... "
314: if /usr/sbin/rndc-confgen -a -t /var/named >/dev/null 2>&1; then
315: chmod 0640 /var/named/etc/rndc.key >/dev/null 2>&1
316: echo done.
317: else
318: echo failed.
319: fi
320: fi
321:
1.58 deraadt 322: echo 'starting named'; named $named_flags
1.94 deraadt 323: fi
324:
325: # $isakmpd_flags is imported from /etc/rc.conf;
1.251 hshoexer 326: # If $isakmpd_flags == NO, isakmpd isn't run.
1.266 millert 327: if [ X"${isakmpd_flags}" != X"NO" ]; then
1.94 deraadt 328: echo 'starting isakmpd'; isakmpd ${isakmpd_flags}
1.40 provos 329: fi
1.1 deraadt 330:
1.276 tom 331: echo -n 'starting initial daemons:'
1.24 millert 332:
1.52 deraadt 333: # $portmap is imported from /etc/rc.conf;
1.24 millert 334: # if $portmap == YES, the portmapper is started.
335: if [ X"${portmap}" = X"YES" ]; then
1.23 deraadt 336: echo -n ' portmap'; portmap
337: fi
1.1 deraadt 338:
1.273 deraadt 339: if [ X`domainname` != X ]; then
1.8 deraadt 340: if [ -d /var/yp/`domainname` ]; then
1.273 deraadt 341: # YP server capabilities needed...
1.36 niklas 342: echo -n ' ypserv'; ypserv ${ypserv_flags}
1.16 deraadt 343: #echo -n ' ypxfrd'; ypxfrd
1.21 deraadt 344: fi
345:
1.273 deraadt 346: if [ -d /var/yp/binding ]; then
347: # YP client capabilities needed...
348: echo -n ' ypbind'; ypbind
349: fi
1.8 deraadt 350:
1.232 deraadt 351: if [ X"${yppasswdd_flags}" != X"NO" -a -d /var/yp/`domainname` ]; then
1.8 deraadt 352: # if we are the master server, run rpc.yppasswdd
353: _host1=`ypwhich -m passwd 2> /dev/null`
354: _host2=`hostname`
1.15 deraadt 355: if [ `grep '^lookup' /etc/resolv.conf | grep yp | wc -c` -ne 0 ]; then
1.8 deraadt 356: _host1=`ypmatch $_host1 hosts | cut -d' ' -f2`
357: _host2=`ypmatch $_host2 hosts | cut -d' ' -f2 | head -1`
358: else
1.263 deraadt 359: _host1=`echo $_host1 | nslookup | grep '^Name: ' | \
1.8 deraadt 360: sed -e 's/^Name: //'`
1.263 deraadt 361: _host2=`echo $_host2 | nslookup | grep '^Name: ' | \
1.8 deraadt 362: sed -e 's/^Name: //'`
363: fi
1.13 deraadt 364: if [ "$_host2" = "$_host1" ]; then
1.35 niklas 365: echo -n ' rpc.yppasswdd'
366: rpc.yppasswdd ${yppasswdd_flags}
1.8 deraadt 367: fi
1.7 deraadt 368: fi
1.1 deraadt 369: fi
370:
1.52 deraadt 371: # $nfs_server is imported from /etc/rc.conf;
1.1 deraadt 372: # if $nfs_server == YES, the machine is setup for being an nfs server
1.266 millert 373: if [ X"${nfs_server}" = X"YES" -a -s /etc/exports -a \
1.141 deraadt 374: `sed -e '/^#/d' < /etc/exports | wc -l` -ne 0 ]; then
1.68 millert 375: rm -f /var/db/mountdtab
1.1 deraadt 376: echo -n > /var/db/mountdtab
377: echo -n ' mountd'; mountd
1.42 niklas 378: echo -n ' nfsd'; nfsd ${nfsd_flags}
1.266 millert 379: if [ X"${lockd}" = X"YES" ]; then
1.42 niklas 380: echo -n ' rpc.lockd'; rpc.lockd
381: fi
1.1 deraadt 382: fi
383:
1.266 millert 384: if [ X"${amd}" = X"YES" -a -e ${amd_master} ]; then
1.1 deraadt 385: echo -n ' amd'
1.107 deraadt 386: (cd /etc/amd; amd -l syslog -x error,noinfo,nostats -p \
387: -a ${amd_dir} `cat ${amd_master}` > /var/run/amd.pid )
1.146 matt 388: fi
389:
1.255 henning 390: # run rdate before timed/ntpd
391: if [ X"${rdate_flags}" != X"NO" ]; then
392: echo -n ' rdate'; rdate -s ${rdate_flags}
393: fi
394:
395: # $timed_flags is imported from /etc/rc.conf;
396: # if $timed_flags == NO, timed isn't run.
1.266 millert 397: if [ X"${timed_flags}" != X"NO" ]; then
1.255 henning 398: echo -n ' timed'; timed $timed_flags
399: fi
400:
1.266 millert 401: if [ X"${ntpd_flags}" != X"NO" ]; then
1.270 deraadt 402: echo -n ' ntpd'; ntpd $ntpd_flags
1.255 henning 403: fi
1.1 deraadt 404: echo '.'
1.58 deraadt 405:
1.278 otto 406: mount -a
1.172 miod 407:
408: swapctl -A -t noblk
1.1 deraadt 409:
410: # /var/crash should be a directory or a symbolic link
411: # to the crash directory if core dumps are to be saved.
412: if [ -d /var/crash ]; then
1.188 tholo 413: savecore ${savecore_flags} /var/crash
1.1 deraadt 414: fi
415:
1.266 millert 416: if [ X"${afs}" = X"YES" -a -c /dev/xfs0 ]; then
1.90 art 417: echo -n 'mounting afs:'
1.233 beck 418: mkdir -p -m 0755 /afs
419: mount -t xfs /dev/xfs0 /afs
1.245 deraadt 420: /usr/libexec/afsd ${afsd_flags}
1.90 art 421: echo ' done.'
422: fi
423:
1.266 millert 424: if [ X"${check_quotas}" = X"YES" ]; then
1.41 downsj 425: echo -n 'checking quotas:'
426: quotacheck -a
427: echo ' done.'
428: quotaon -a
429: fi
1.1 deraadt 430:
431: # build ps databases
1.95 deraadt 432: echo -n 'building ps databases:'
433: echo -n " kvm"
1.88 millert 434: kvm_mkdb
1.95 deraadt 435: echo -n " dev"
1.1 deraadt 436: dev_mkdb
1.95 deraadt 437: echo "."
1.1 deraadt 438:
1.101 deraadt 439: chmod 666 /dev/tty[pqrstuvwxyzPQRST]*
1.226 millert 440: chown root:wheel /dev/tty[pqrstuvwxyzPQRST]*
1.1 deraadt 441:
442: # check the password temp/lock file
1.17 deraadt 443: if [ -f /etc/ptmp ]; then
1.1 deraadt 444: logger -s -p auth.err \
445: 'password file may be incorrect -- /etc/ptmp exists'
1.32 deraadt 446: fi
447:
1.49 millert 448: echo clearing /tmp
449:
450: # prune quickly with one rm, then use find to clean up /tmp/[lq]*
451: # (not needed with mfs /tmp, but doesn't hurt there...)
452: (cd /tmp && rm -rf [a-km-pr-zA-Z]* &&
453: find . ! -name . ! -name lost+found ! -name quota.user \
1.103 millert 454: ! -name quota.group -execdir rm -rf -- {} \; -type d -prune)
1.49 millert 455:
1.256 henning 456: # create Unix sockets directories for X if needed and make sure they have
1.203 hugh 457: # correct permissions
1.210 henning 458: if [ -d /usr/X11R6/lib ]; then
1.203 hugh 459: for d in /tmp/.X11-unix /tmp/.ICE-unix ; do
1.210 henning 460: if [ -d $d ]; then
1.203 hugh 461: if [ `ls -ld $d | cut -d' ' -f4` != root ]; then
462: chown root $d
463: fi
464: if [ `ls -ld $d | cut -d' ' -f1` != drwxrwxrwt ]; then
465: chmod 1777 $d
466: fi
467: elif [ -e $d ]; then
468: echo "Error: $d exists and isn't a directory."
469: else
470: mkdir -m 1777 $d
471: fi
472: done
473: fi
474:
1.72 deraadt 475: [ -f /etc/rc.securelevel ] && . /etc/rc.securelevel
1.266 millert 476: if [ X"${securelevel}" != X"" ]; then
1.33 millert 477: echo -n 'setting kernel security level: '
1.234 jmc 478: sysctl kern.securelevel=${securelevel}
1.1 deraadt 479: fi
480:
1.34 deraadt 481: # patch /etc/motd
482: if [ ! -f /etc/motd ]; then
483: install -c -o root -g wheel -m 664 /dev/null /etc/motd
484: fi
1.131 millert 485: T=`mktemp /tmp/_motd.XXXXXXXXXX`
1.105 millert 486: if [ $? -eq 0 ]; then
1.102 millert 487: sysctl -n kern.version | sed 1q > $T
488: echo "" >> $T
489: sed '1,/^$/d' < /etc/motd >> $T
490: cmp -s $T /etc/motd || cp $T /etc/motd
491: rm -f $T
492: fi
1.34 deraadt 493:
1.1 deraadt 494: if [ -f /var/account/acct ]; then
495: echo 'turning on accounting'; accton /var/account/acct
496: fi
497:
1.115 deraadt 498: if [ -f /sbin/ldconfig ]; then
499: echo 'creating runtime link editor directory cache.'
500: if [ -d /usr/local/lib ]; then
1.183 todd 501: shlib_dirs="/usr/local/lib $shlib_dirs"
1.115 deraadt 502: fi
503: if [ -d /usr/X11R6/lib ]; then
1.183 todd 504: shlib_dirs="/usr/X11R6/lib $shlib_dirs"
1.115 deraadt 505: fi
506: ldconfig $shlib_dirs
1.231 millert 507: fi
508:
509: if [ -x /usr/libexec/vi.recover ]; then
510: echo 'preserving editor files'; /usr/libexec/vi.recover
1.115 deraadt 511: fi
512:
1.189 deraadt 513: if [ ! -f /etc/ssh/ssh_host_dsa_key ]; then
1.133 deraadt 514: echo -n "ssh-keygen: generating new DSA host key... "
1.189 deraadt 515: if /usr/bin/ssh-keygen -q -t dsa -f /etc/ssh/ssh_host_dsa_key -N ''; then
1.163 deraadt 516: echo done.
517: else
518: echo failed.
519: fi
520: fi
1.189 deraadt 521: if [ ! -f /etc/ssh/ssh_host_rsa_key ]; then
1.163 deraadt 522: echo -n "ssh-keygen: generating new RSA host key... "
1.189 deraadt 523: if /usr/bin/ssh-keygen -q -t rsa -f /etc/ssh/ssh_host_rsa_key -N ''; then
1.133 deraadt 524: echo done.
525: else
526: echo failed.
527: fi
528: fi
1.189 deraadt 529: if [ ! -f /etc/ssh/ssh_host_key ]; then
1.187 markus 530: echo -n "ssh-keygen: generating new RSA1 host key... "
1.189 deraadt 531: if /usr/bin/ssh-keygen -q -t rsa1 -f /etc/ssh/ssh_host_key -N ''; then
1.244 markus 532: echo done.
533: else
534: echo failed.
535: fi
536: fi
537:
538: if [ ! -f /etc/isakmpd/private/local.key ]; then
539: echo -n "openssl: generating new isakmpd RSA key... "
540: if /usr/sbin/openssl genrsa -out /etc/isakmpd/private/local.key 1024 \
541: > /dev/null 2>&1; then
542: chmod 600 /etc/isakmpd/private/local.key
543: openssl rsa -out /etc/isakmpd/private/local.pub \
544: -in /etc/isakmpd/private/local.key -pubout > /dev/null 2>&1
1.114 deraadt 545: echo done.
546: else
547: echo failed.
548: fi
549: fi
550:
1.1 deraadt 551: echo -n starting network daemons:
552:
1.227 ian 553: # $routed_flags are imported from /etc/rc.conf.
1.1 deraadt 554: # If $routed_flags == NO, routed isn't run.
1.266 millert 555: if [ X"${routed_flags}" != X"NO" ]; then
1.1 deraadt 556: echo -n ' routed'; routed $routed_flags
557: fi
558:
1.52 deraadt 559: # $mrouted_flags is imported from /etc/rc.conf;
1.4 deraadt 560: # If $mrouted_flags == NO, then mrouted isn't run.
1.266 millert 561: if [ X"${mrouted_flags}" != X"NO" ]; then
1.4 deraadt 562: echo -n ' mrouted'; mrouted $mrouted_flags
1.262 henning 563: fi
564:
1.266 millert 565: if [ X"${ospfd_flags}" != X"NO" ]; then
1.262 henning 566: echo -n ' ospfd'; /usr/sbin/ospfd $ospfd_flags
1.239 henning 567: fi
568:
1.266 millert 569: if [ X"${bgpd_flags}" != X"NO" ]; then
1.239 henning 570: echo -n ' bgpd'; /usr/sbin/bgpd $bgpd_flags
1.4 deraadt 571: fi
1.1 deraadt 572:
1.86 form 573: # $dhcpd_flags is imported from /etc/rc.conf
574: # If $dhcpd_flags == NO or /etc/dhcpd.conf doesn't exist, then dhcpd isn't run.
1.266 millert 575: if [ X"${dhcpd_flags}" != X"NO" -a -f /etc/dhcpd.conf ]; then
1.86 form 576: touch /var/db/dhcpd.leases
577: if [ -f /etc/dhcpd.interfaces ]; then
1.207 mpech 578: dhcpd_ifs=`stripcom /etc/dhcpd.interfaces`
1.86 form 579: fi
580: echo -n ' dhcpd'; /usr/sbin/dhcpd ${dhcpd_flags} ${dhcpd_ifs}
1.127 itojun 581: fi
582:
583: if ifconfig lo0 inet6 >/dev/null 2>&1; then
584: fw=`sysctl -n net.inet6.ip6.forwarding`
1.266 millert 585: if [ X"${fw}" = X"0" ]; then
1.127 itojun 586: # $rtsold_flags is imported from /etc/rc.conf;
587: # If $rtsold_flags == NO, then rtsold isn't run.
1.266 millert 588: if [ X"${rtsold_flags}" != X"NO" ]; then
1.127 itojun 589: echo -n ' rtsold'
590: /usr/sbin/rtsold ${rtsold_flags}
591: fi
592: else
593: # $route6d_flags is imported from /etc/rc.conf;
594: # If $route6d_flags == NO, then route6d isn't run.
1.266 millert 595: if [ X"${route6d_flags}" != X"NO" ]; then
1.127 itojun 596: echo -n ' route6d'
597: /usr/sbin/route6d ${route6d_flags}
598: fi
599: # $rtadvd_flags is imported from /etc/rc.conf;
1.147 itojun 600: # If $rtadvd_flags == NO, then rtadvd isn't run.
1.266 millert 601: if [ X"${rtadvd_flags}" != X"NO" ]; then
1.127 itojun 602: echo -n ' rtadvd'
603: /usr/sbin/rtadvd ${rtadvd_flags}
604: fi
605: fi
1.86 form 606: fi
607:
1.52 deraadt 608: # $rwhod is imported from /etc/rc.conf;
1.1 deraadt 609: # if $rwhod == YES, rwhod is run.
1.266 millert 610: if [ X"${rwhod}" = X"YES" ]; then
1.1 deraadt 611: echo -n ' rwhod'; rwhod
612: fi
613:
1.23 deraadt 614:
1.266 millert 615: if [ X"${lpd_flags}" != X"NO" ]; then
1.272 fgsch 616: echo -n ' lpd'; lpd ${lpd_flags}
1.23 deraadt 617: fi
1.1 deraadt 618:
1.52 deraadt 619: # $sendmail_flags is imported from /etc/rc.conf;
1.154 millert 620: # If $sendmail_flags == NO or /etc/mailer.conf doesn't exist, then
1.255 henning 621: # sendmail isn't run. We call sendmail with a full path so that
622: # SIGHUP works. Note that /usr/sbin/sendmail may actually call a
1.154 millert 623: # mailer other than sendmail, depending on /etc/mailer.conf.
1.266 millert 624: if [ X"${sendmail_flags}" != X"NO" -a -s /etc/mailer.conf ]; then
1.153 millert 625: echo -n ' sendmail'; ( /usr/sbin/sendmail ${sendmail_flags} >/dev/null 2>&1 & )
1.212 deraadt 626: fi
627:
1.266 millert 628: if [ X"${httpd_flags}" != X"NO" ]; then
1.143 espie 629: # Clean up left-over httpd locks
630: rm -f /var/www/logs/{ssl_mutex,httpd.lock,accept.lock}.*
1.160 angelos 631: echo -n ' httpd'; /usr/sbin/httpd ${httpd_flags}
1.93 downsj 632: fi
633:
1.266 millert 634: if [ X"${ftpd_flags}" != X"NO" ]; then
1.93 downsj 635: echo -n ' ftpd'; /usr/libexec/ftpd ${ftpd_flags}
1.275 camield 636: fi
637:
638: if [ X"${ftpproxy_flags}" != X"NO" ]; then
639: echo -n ' ftp-proxy'; /usr/sbin/ftp-proxy ${ftpproxy_flags}
1.124 fgsch 640: fi
641:
1.266 millert 642: if [ X"${identd_flags}" != X"NO" ]; then
1.124 fgsch 643: echo -n ' identd'; /usr/libexec/identd ${identd_flags}
1.1 deraadt 644: fi
645:
1.266 millert 646: if [ X"${inetd}" = X"YES" -a -e /etc/inetd.conf ]; then
1.23 deraadt 647: echo -n ' inetd'; inetd
1.237 deraadt 648: fi
649:
650: if [ X"${sshd_flags}" != X"NO" ]; then
651: echo -n ' sshd'; /usr/sbin/sshd ${sshd_flags};
1.238 deraadt 652: fi
653:
1.266 millert 654: if [ X"${spamd_flags}" != X"NO" ]; then
655: if [ X"${spamd_grey}" != X"NO" ]; then
1.238 deraadt 656: spamd_flags="${spamd_flags} -g"
657: fi
1.242 otto 658: echo -n ' spamd'; eval /usr/libexec/spamd ${spamd_flags}
1.238 deraadt 659: /usr/libexec/spamd-setup
1.266 millert 660: if [ X"${spamd_grey}" != X"NO" ]; then
1.238 deraadt 661: echo -n ' spamlogd'
1.259 henning 662: /usr/libexec/spamlogd ${spamlogd_flags}
1.238 deraadt 663: fi
1.23 deraadt 664: fi
1.1 deraadt 665:
1.52 deraadt 666: # $rarpd_flags is imported from /etc/rc.conf;
1.1 deraadt 667: # If $rarpd_flags == NO or /etc/ethers doesn't exist, then
668: # rarpd isn't run.
1.266 millert 669: if [ X"${rarpd_flags}" != X"NO" -a -s /etc/ethers ]; then
1.1 deraadt 670: echo -n ' rarpd'; rarpd ${rarpd_flags}
671: fi
672:
1.52 deraadt 673: # $bootparamd_flags is imported from /etc/rc.conf;
1.1 deraadt 674: # If $bootparamd_flags == NO or /etc/bootparams doesn't exist, then
675: # bootparamd isn't run.
1.266 millert 676: if [ X"${bootparamd_flags}" != X"NO" -a -s /etc/bootparams ]; then
1.1 deraadt 677: echo -n ' rpc.bootparamd'; rpc.bootparamd ${bootparamd_flags}
678: fi
679:
1.52 deraadt 680: # $rbootd_flags is imported from /etc/rc.conf;
1.1 deraadt 681: # If $rbootd_flags == NO or /etc/rbootd.conf doesn't exist, then
682: # rbootd isn't run.
1.266 millert 683: if [ X"${rbootd_flags}" != X"NO" -a -s /etc/rbootd.conf ]; then
1.1 deraadt 684: echo -n ' rbootd'; rbootd ${rbootd_flags}
1.56 maja 685: fi
686:
687: # $mopd_flags is imported from /etc/rc.conf;
688: # If $mopd_flags == NO or /tftpboot/mop doesn't exist, then
689: # mopd isn't run.
1.266 millert 690: if [ X"${mopd_flags}" != X"NO" -a -d /tftpboot/mop ]; then
1.56 maja 691: echo -n ' mopd'; mopd ${mopd_flags}
1.1 deraadt 692: fi
693:
694: echo '.'
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: