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