Source code pulled from OpenBSD for OpenNTPD. The place to contribute to this code is via the OpenBSD CVS tree.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

751 lines
18 KiB

23 years ago
27 years ago
28 years ago
28 years ago
20 years ago
27 years ago
25 years ago
27 years ago
21 years ago
23 years ago
  1. # $OpenBSD: rc,v 1.292 2006/10/29 18:58:57 norby Exp $
  2. # System startup script run by init on autoboot
  3. # or after single-user.
  4. # Output and error are redirected to console by init,
  5. # and the console is the controlling terminal.
  6. # Subroutines (have to come first).
  7. # Strip comments (and leading/trailing whitespace if IFS is set)
  8. # from a file and spew to stdout
  9. stripcom() {
  10. local _file="$1"
  11. local _line
  12. {
  13. while read _line ; do
  14. _line=${_line%%#*} # strip comments
  15. test -z "$_line" && continue
  16. echo $_line
  17. done
  18. } < $_file
  19. }
  20. # Update resource limits when sysctl changes
  21. # Usage: update_limit -X loginconf_name
  22. update_limit() {
  23. local _fl="$1" # ulimit flag
  24. local _lc="$2" # login.conf name
  25. local _new _suf
  26. for _suf in "" -cur -max; do
  27. _new=`getcap -f /etc/login.conf -s ${_lc}${_suf} daemon 2>/dev/null`
  28. if [ X"$_new" != X"" ]; then
  29. if [ X"$_new" = X"infinity" ]; then
  30. _new=unlimited
  31. fi
  32. case "$_suf" in
  33. -cur)
  34. ulimit -S $_fl $_new
  35. ;;
  36. -max)
  37. ulimit -H $_fl $_new
  38. ;;
  39. *)
  40. ulimit $_fl $_new
  41. return
  42. ;;
  43. esac
  44. fi
  45. done
  46. }
  47. sysctl_conf() {
  48. test -s /etc/sysctl.conf || return
  49. # delete comments and blank lines
  50. set -- `stripcom /etc/sysctl.conf`
  51. while [ $# -ge 1 ] ; do
  52. sysctl $1
  53. # update limits if needed
  54. case $1 in
  55. kern.maxproc=*)
  56. update_limit -p maxproc
  57. ;;
  58. kern.maxfiles=*)
  59. update_limit -n openfiles
  60. ;;
  61. esac
  62. shift
  63. done
  64. }
  65. mixerctl_conf()
  66. {
  67. test -s /etc/mixerctl.conf || return
  68. # delete comments and blank lines
  69. set -- `stripcom /etc/mixerctl.conf`
  70. while [ $# -ge 1 ] ; do
  71. mixerctl -q $1 > /dev/null 2>&1
  72. shift
  73. done
  74. }
  75. wsconsctl_conf()
  76. {
  77. local save_IFS="$IFS"
  78. test -x /sbin/wsconsctl -a -s /etc/wsconsctl.conf || return
  79. # delete comments and blank lines
  80. IFS="
  81. "
  82. set -- `stripcom /etc/wsconsctl.conf`
  83. IFS="$save_IFS"
  84. while [ $# -ge 1 ] ; do
  85. eval /sbin/wsconsctl -w $1
  86. shift
  87. done
  88. }
  89. # End subroutines
  90. stty status '^T'
  91. # Set shell to ignore SIGINT (2), but not children;
  92. # shell catches SIGQUIT (3) and returns to single user after fsck.
  93. trap : 2
  94. trap : 3 # shouldn't be needed
  95. HOME=/; export HOME
  96. PATH=/sbin:/bin:/usr/sbin:/usr/bin
  97. export PATH
  98. if [ X"$1" = X"shutdown" ]; then
  99. dd if=/dev/urandom of=/var/db/host.random bs=1024 count=64 >/dev/null 2>&1
  100. chmod 600 /var/db/host.random >/dev/null 2>&1
  101. if [ $? -eq 0 -a -f /etc/rc.shutdown ]; then
  102. echo /etc/rc.shutdown in progress...
  103. . /etc/rc.shutdown
  104. echo /etc/rc.shutdown complete.
  105. # bring carp interfaces down gracefully
  106. for hn in /etc/hostname.carp[0-9]*; do
  107. # Strip off /etc/hostname. prefix
  108. if=${hn#/etc/hostname.}
  109. test "$if" = "carp[0-9]*" && continue
  110. ifconfig $if > /dev/null 2>&1
  111. if [ $? -eq 0 ]; then
  112. ifconfig $if down
  113. fi
  114. done
  115. if [ X"${powerdown}" = X"YES" ]; then
  116. exit 2
  117. fi
  118. else
  119. echo single user: not running /etc/rc.shutdown
  120. fi
  121. exit 0
  122. fi
  123. # Configure ccd devices.
  124. if [ -f /etc/ccd.conf ]; then
  125. ccdconfig -C
  126. fi
  127. # Configure raid devices.
  128. for dev in 0 1 2 3; do
  129. if [ -f /etc/raid$dev.conf ]; then
  130. raidctl -c /etc/raid$dev.conf raid$dev
  131. fi
  132. done
  133. # Check parity on raid devices.
  134. raidctl -P all
  135. swapctl -A -t blk
  136. if [ -e /fastboot ]; then
  137. echo "Fast boot: skipping disk checks."
  138. elif [ X"$1" = X"autoboot" ]; then
  139. echo "Automatic boot in progress: starting file system checks."
  140. fsck -p
  141. case $? in
  142. 0)
  143. ;;
  144. 2)
  145. exit 1
  146. ;;
  147. 4)
  148. echo "Rebooting..."
  149. reboot
  150. echo "Reboot failed; help!"
  151. exit 1
  152. ;;
  153. 8)
  154. echo "Automatic file system check failed; help!"
  155. exit 1
  156. ;;
  157. 12)
  158. echo "Boot interrupted."
  159. exit 1
  160. ;;
  161. 130)
  162. # interrupt before catcher installed
  163. exit 1
  164. ;;
  165. *)
  166. echo "Unknown error; help!"
  167. exit 1
  168. ;;
  169. esac
  170. fi
  171. trap "echo 'Boot interrupted.'; exit 1" 3
  172. umount -a >/dev/null 2>&1
  173. mount -a -t nonfs
  174. mount -uw / # root on nfs requires this, others aren't hurt
  175. rm -f /fastboot # XXX (root now writeable)
  176. # pick up option configuration
  177. . /etc/rc.conf
  178. # set flags on ttys. (do early, in case they use tty for SLIP in netstart)
  179. echo 'setting tty flags'
  180. ttyflags -a
  181. if [ -f /sbin/kbd -a -f /etc/kbdtype ]; then
  182. kbd `cat /etc/kbdtype`
  183. fi
  184. wsconsctl_conf
  185. if [ X"${pf}" != X"NO" ]; then
  186. RULES="block all"
  187. RULES="$RULES\npass on lo0"
  188. RULES="$RULES\npass in proto tcp from any to any port 22 keep state"
  189. RULES="$RULES\npass out proto { tcp, udp } from any to any port 53 keep state"
  190. RULES="$RULES\npass out inet proto icmp all icmp-type echoreq keep state"
  191. if ifconfig lo0 inet6 >/dev/null 2>&1; then
  192. RULES="$RULES\npass out inet6 proto icmp6 all icmp6-type neighbrsol"
  193. RULES="$RULES\npass in inet6 proto icmp6 all icmp6-type neighbradv"
  194. RULES="$RULES\npass out inet6 proto icmp6 all icmp6-type routersol"
  195. RULES="$RULES\npass in inet6 proto icmp6 all icmp6-type routeradv"
  196. fi
  197. RULES="$RULES\npass proto { pfsync, carp }"
  198. case `sysctl vfs.mounts.nfs 2>/dev/null` in
  199. *[1-9]*)
  200. # don't kill NFS
  201. RULES="scrub in all no-df\n$RULES"
  202. RULES="$RULES\npass in proto udp from any port { 111, 2049 } to any"
  203. RULES="$RULES\npass out proto udp from any to any port { 111, 2049 }"
  204. ;;
  205. esac
  206. echo $RULES | pfctl -f -
  207. pfctl -e
  208. fi
  209. sysctl_conf
  210. # set hostname, turn on network
  211. echo 'starting network'
  212. ifconfig -g carp carpdemote 128
  213. if [ -f /etc/resolv.conf.save ]; then
  214. mv /etc/resolv.conf.save /etc/resolv.conf
  215. touch /etc/resolv.conf
  216. fi
  217. . /etc/netstart
  218. if [ X"${pf}" != X"NO" ]; then
  219. if [ -f ${pf_rules} ]; then
  220. pfctl -f ${pf_rules}
  221. fi
  222. fi
  223. mount -s /usr >/dev/null 2>&1
  224. mount -s /var >/dev/null 2>&1
  225. # if there's no /var/db/host.random, make one through /dev/urandom
  226. if [ ! -f /var/db/host.random ]; then
  227. dd if=/dev/urandom of=/var/db/host.random bs=1024 count=64 \
  228. >/dev/null 2>&1
  229. chmod 600 /var/db/host.random >/dev/null 2>&1
  230. else
  231. dd if=/var/db/host.random of=/dev/urandom bs=1024 count=64 \
  232. > /dev/null 2>&1
  233. dd if=/var/db/host.random of=/dev/arandom bs=1024 count=64 \
  234. > /dev/null 2>&1
  235. fi
  236. # reset seed file, so that if a shutdown-less reboot occurs,
  237. # the next seed is not a repeat
  238. dd if=/dev/urandom of=/var/db/host.random bs=1024 count=64 \
  239. > /dev/null 2>&1
  240. # clean up left-over files
  241. rm -f /etc/nologin
  242. rm -f /var/spool/lock/LCK.*
  243. rm -f /var/spool/uucp/STST/*
  244. (cd /var/run && { rm -rf -- *; install -c -m 664 -g utmp /dev/null utmp; })
  245. (cd /var/authpf && rm -rf -- *)
  246. # save a copy of the boot messages
  247. dmesg >/var/run/dmesg.boot
  248. echo 'starting system logger'
  249. rm -f /dev/log
  250. if [ X"${named_flags}" != X"NO" ]; then
  251. rm -f /var/named/dev/log
  252. syslogd_flags="${syslogd_flags} -a /var/named/dev/log"
  253. fi
  254. if [ -d /var/empty ]; then
  255. rm -f /var/empty/dev/log
  256. mkdir -p -m 0555 /var/empty/dev
  257. syslogd_flags="${syslogd_flags} -a /var/empty/dev/log"
  258. fi
  259. syslogd ${syslogd_flags}
  260. if [ X"${pf}" != X"NO" -a X"${pflogd_flags}" != X"NO" ]; then
  261. if ifconfig pflog0 >/dev/null 2>&1; then
  262. ifconfig pflog0 up
  263. pflogd ${pflogd_flags}
  264. fi
  265. fi
  266. if [ X"${named_flags}" != X"NO" ]; then
  267. if ! cmp -s /etc/rndc.key /var/named/etc/rndc.key ; then
  268. echo -n "rndc-confgen: generating new shared secret... "
  269. if /usr/sbin/rndc-confgen -a -t /var/named >/dev/null 2>&1; then
  270. chmod 0640 /var/named/etc/rndc.key >/dev/null 2>&1
  271. echo done.
  272. else
  273. echo failed.
  274. fi
  275. fi
  276. echo 'starting named'; named $named_flags
  277. fi
  278. if [ X"${isakmpd_flags}" != X"NO" ]; then
  279. if [ X"${sasyncd_flags}" != X"NO" ]; then
  280. isakmpd_flags="-S ${isakmpd_flags}"
  281. fi
  282. echo 'starting isakmpd'; isakmpd ${isakmpd_flags}
  283. fi
  284. if [ X"${sasyncd_flags}" != X"NO" ]; then
  285. echo 'starting sasyncd'; sasyncd ${sasyncd_flags}
  286. fi
  287. if [ X"${ipsec}" != X"NO" ]; then
  288. if [ -f ${ipsec_rules} ]; then
  289. ipsecctl -f ${ipsec_rules}
  290. fi
  291. fi
  292. echo -n 'starting initial daemons:'
  293. if [ X"${portmap}" = X"YES" ]; then
  294. echo -n ' portmap'; portmap
  295. fi
  296. if [ X`domainname` != X ]; then
  297. if [ -d /var/yp/`domainname` ]; then
  298. # YP server capabilities needed...
  299. echo -n ' ypserv'; ypserv ${ypserv_flags}
  300. #echo -n ' ypxfrd'; ypxfrd
  301. fi
  302. if [ -d /var/yp/binding ]; then
  303. # YP client capabilities needed...
  304. echo -n ' ypbind'; ypbind
  305. fi
  306. if [ X"${yppasswdd_flags}" != X"NO" -a -d /var/yp/`domainname` ]; then
  307. # if we are the master server, run rpc.yppasswdd
  308. _host1=`ypwhich -m passwd 2> /dev/null`
  309. _host2=`hostname`
  310. if [ `grep '^lookup' /etc/resolv.conf | grep yp | wc -c` -ne 0 ]; then
  311. _host1=`ypmatch $_host1 hosts | cut -d' ' -f2`
  312. _host2=`ypmatch $_host2 hosts | cut -d' ' -f2 | head -1`
  313. else
  314. _host1=`echo $_host1 | nslookup | grep '^Name: ' | \
  315. sed -e 's/^Name: //'`
  316. _host2=`echo $_host2 | nslookup | grep '^Name: ' | \
  317. sed -e 's/^Name: //'`
  318. fi
  319. if [ "$_host2" = "$_host1" ]; then
  320. echo -n ' rpc.yppasswdd'
  321. rpc.yppasswdd ${yppasswdd_flags}
  322. fi
  323. fi
  324. fi
  325. if [ X"${nfs_server}" = X"YES" -a -s /etc/exports -a \
  326. `sed -e '/^#/d' < /etc/exports | wc -l` -ne 0 ]; then
  327. rm -f /var/db/mountdtab
  328. echo -n > /var/db/mountdtab
  329. echo -n ' mountd'; mountd
  330. echo -n ' nfsd'; nfsd ${nfsd_flags}
  331. if [ X"${lockd}" = X"YES" ]; then
  332. echo -n ' rpc.lockd'; rpc.lockd
  333. fi
  334. fi
  335. if [ X"${amd}" = X"YES" -a -e ${amd_master} ]; then
  336. echo -n ' amd'
  337. (cd /etc/amd; amd -l syslog -x error,noinfo,nostats -p \
  338. -a ${amd_dir} `cat ${amd_master}` > /var/run/amd.pid )
  339. fi
  340. # run rdate before timed/ntpd
  341. if [ X"${rdate_flags}" != X"NO" ]; then
  342. echo -n ' rdate'; rdate -s ${rdate_flags}
  343. fi
  344. if [ X"${timed_flags}" != X"NO" ]; then
  345. echo -n ' timed'; timed $timed_flags
  346. fi
  347. if [ X"${ntpd_flags}" != X"NO" ]; then
  348. echo -n ' ntpd'; ntpd $ntpd_flags
  349. fi
  350. echo '.'
  351. mount -a
  352. swapctl -A -t noblk
  353. # /var/crash should be a directory or a symbolic link
  354. # to the crash directory if core dumps are to be saved.
  355. if [ -d /var/crash ]; then
  356. savecore ${savecore_flags} /var/crash
  357. fi
  358. if [ X"${afs}" = X"YES" -a -c /dev/xfs0 ]; then
  359. echo -n 'mounting afs:'
  360. mkdir -p -m 0755 /afs
  361. mount -t xfs /dev/xfs0 /afs
  362. /usr/libexec/afsd ${afsd_flags}
  363. echo ' done.'
  364. fi
  365. if [ X"${check_quotas}" = X"YES" ]; then
  366. echo -n 'checking quotas:'
  367. quotacheck -a
  368. echo ' done.'
  369. quotaon -a
  370. fi
  371. # build ps databases
  372. echo -n 'building ps databases:'
  373. echo -n " kvm"
  374. kvm_mkdb
  375. echo -n " dev"
  376. dev_mkdb
  377. echo "."
  378. chmod 666 /dev/tty[pqrstuvwxyzPQRST]*
  379. chown root:wheel /dev/tty[pqrstuvwxyzPQRST]*
  380. # check the password temp/lock file
  381. if [ -f /etc/ptmp ]; then
  382. logger -s -p auth.err \
  383. 'password file may be incorrect -- /etc/ptmp exists'
  384. fi
  385. echo clearing /tmp
  386. # prune quickly with one rm, then use find to clean up /tmp/[lq]*
  387. # (not needed with mfs /tmp, but doesn't hurt there...)
  388. (cd /tmp && rm -rf [a-km-pr-zA-Z]* &&
  389. find . ! -name . ! -name lost+found ! -name quota.user \
  390. ! -name quota.group -execdir rm -rf -- {} \; -type d -prune)
  391. # create Unix sockets directories for X if needed and make sure they have
  392. # correct permissions
  393. if [ -d /usr/X11R6/lib ]; then
  394. for d in /tmp/.X11-unix /tmp/.ICE-unix ; do
  395. if [ -d $d ]; then
  396. if [ `ls -ld $d | cut -d' ' -f4` != root ]; then
  397. chown root $d
  398. fi
  399. if [ `ls -ld $d | cut -d' ' -f1` != drwxrwxrwt ]; then
  400. chmod 1777 $d
  401. fi
  402. elif [ -e $d ]; then
  403. echo "Error: $d exists and isn't a directory."
  404. else
  405. mkdir -m 1777 $d
  406. fi
  407. done
  408. fi
  409. [ -f /etc/rc.securelevel ] && . /etc/rc.securelevel
  410. if [ X"${securelevel}" != X"" ]; then
  411. echo -n 'setting kernel security level: '
  412. sysctl kern.securelevel=${securelevel}
  413. fi
  414. # patch /etc/motd
  415. if [ ! -f /etc/motd ]; then
  416. install -c -o root -g wheel -m 664 /dev/null /etc/motd
  417. fi
  418. T=`mktemp /tmp/_motd.XXXXXXXXXX`
  419. if [ $? -eq 0 ]; then
  420. sysctl -n kern.version | sed 1q > $T
  421. echo "" >> $T
  422. sed '1,/^$/d' < /etc/motd >> $T
  423. cmp -s $T /etc/motd || cp $T /etc/motd
  424. rm -f $T
  425. fi
  426. if [ -f /var/account/acct ]; then
  427. echo 'turning on accounting'; accton /var/account/acct
  428. fi
  429. if [ -f /sbin/ldconfig ]; then
  430. echo 'creating runtime link editor directory cache.'
  431. if [ -d /usr/local/lib ]; then
  432. shlib_dirs="/usr/local/lib $shlib_dirs"
  433. fi
  434. if [ -d /usr/X11R6/lib ]; then
  435. shlib_dirs="/usr/X11R6/lib $shlib_dirs"
  436. fi
  437. ldconfig $shlib_dirs
  438. fi
  439. if [ -x /usr/libexec/vi.recover ]; then
  440. echo 'preserving editor files'; /usr/libexec/vi.recover
  441. fi
  442. if [ ! -f /etc/ssh/ssh_host_dsa_key ]; then
  443. echo -n "ssh-keygen: generating new DSA host key... "
  444. if /usr/bin/ssh-keygen -q -t dsa -f /etc/ssh/ssh_host_dsa_key -N ''; then
  445. echo done.
  446. else
  447. echo failed.
  448. fi
  449. fi
  450. if [ ! -f /etc/ssh/ssh_host_rsa_key ]; then
  451. echo -n "ssh-keygen: generating new RSA host key... "
  452. if /usr/bin/ssh-keygen -q -t rsa -f /etc/ssh/ssh_host_rsa_key -N ''; then
  453. echo done.
  454. else
  455. echo failed.
  456. fi
  457. fi
  458. if [ ! -f /etc/ssh/ssh_host_key ]; then
  459. echo -n "ssh-keygen: generating new RSA1 host key... "
  460. if /usr/bin/ssh-keygen -q -t rsa1 -f /etc/ssh/ssh_host_key -N ''; then
  461. echo done.
  462. else
  463. echo failed.
  464. fi
  465. fi
  466. if [ ! -f /etc/isakmpd/private/local.key ]; then
  467. echo -n "openssl: generating new isakmpd RSA key... "
  468. if /usr/sbin/openssl genrsa -out /etc/isakmpd/private/local.key 1024 \
  469. > /dev/null 2>&1; then
  470. chmod 600 /etc/isakmpd/private/local.key
  471. openssl rsa -out /etc/isakmpd/private/local.pub \
  472. -in /etc/isakmpd/private/local.key -pubout > /dev/null 2>&1
  473. echo done.
  474. else
  475. echo failed.
  476. fi
  477. fi
  478. echo -n starting network daemons:
  479. if [ X"${routed_flags}" != X"NO" ]; then
  480. echo -n ' routed'; routed $routed_flags
  481. fi
  482. if [ X"${ripd_flags}" != X"NO" ]; then
  483. echo -n ' ripd'; /usr/sbin/ripd $ripd_flags
  484. fi
  485. if [ X"${mrouted_flags}" != X"NO" ]; then
  486. echo -n ' mrouted'; mrouted $mrouted_flags
  487. fi
  488. if [ X"${dvmrpd_flags}" != X"NO" ]; then
  489. echo -n ' dvmrpd'; /usr/sbin/dvmrpd $dvmrpd_flags
  490. fi
  491. if [ X"${ospfd_flags}" != X"NO" ]; then
  492. echo -n ' ospfd'; /usr/sbin/ospfd $ospfd_flags
  493. fi
  494. if [ X"${bgpd_flags}" != X"NO" ]; then
  495. echo -n ' bgpd'; /usr/sbin/bgpd $bgpd_flags
  496. fi
  497. if [ X"${ifstated_flags}" != X"NO" ]; then
  498. echo -n ' ifstated'; ifstated $ifstated_flags
  499. fi
  500. if [ X"${dhcpd_flags}" != X"NO" -a -f /etc/dhcpd.conf ]; then
  501. touch /var/db/dhcpd.leases
  502. if [ -f /etc/dhcpd.interfaces ]; then
  503. dhcpd_ifs=`stripcom /etc/dhcpd.interfaces`
  504. fi
  505. echo -n ' dhcpd'; /usr/sbin/dhcpd ${dhcpd_flags} ${dhcpd_ifs}
  506. fi
  507. if [ X"${dhcrelay_flags}" != X"NO" ]; then
  508. echo -n ' dhcrelay'; /usr/sbin/dhcrelay $dhcrelay_flags
  509. fi
  510. if ifconfig lo0 inet6 >/dev/null 2>&1; then
  511. fw=`sysctl -n net.inet6.ip6.forwarding`
  512. if [ X"${fw}" = X"0" ]; then
  513. if [ X"${rtsold_flags}" != X"NO" ]; then
  514. echo -n ' rtsold'
  515. /usr/sbin/rtsold ${rtsold_flags}
  516. fi
  517. else
  518. if [ X"${route6d_flags}" != X"NO" ]; then
  519. echo -n ' route6d'
  520. /usr/sbin/route6d ${route6d_flags}
  521. fi
  522. if [ X"${rtadvd_flags}" != X"NO" ]; then
  523. echo -n ' rtadvd'
  524. /usr/sbin/rtadvd ${rtadvd_flags}
  525. fi
  526. fi
  527. fi
  528. if [ X"${hostapd_flags}" != X"NO" ]; then
  529. echo -n ' hostapd'; /usr/sbin/hostapd ${hostapd_flags};
  530. fi
  531. if [ X"${rwhod}" = X"YES" ]; then
  532. echo -n ' rwhod'; rwhod
  533. fi
  534. if [ X"${lpd_flags}" != X"NO" ]; then
  535. echo -n ' lpd'; lpd ${lpd_flags}
  536. fi
  537. # We call sendmail with a full path so that SIGHUP works.
  538. # Note that /usr/sbin/sendmail may actually call a
  539. # mailer other than sendmail, depending on /etc/mailer.conf.
  540. if [ X"${sendmail_flags}" != X"NO" -a -s /etc/mailer.conf ]; then
  541. echo -n ' sendmail'; ( /usr/sbin/sendmail ${sendmail_flags} >/dev/null 2>&1 & )
  542. fi
  543. if [ X"${httpd_flags}" != X"NO" ]; then
  544. # Clean up left-over httpd locks
  545. rm -f /var/www/logs/{ssl_mutex,httpd.lock,accept.lock}.*
  546. echo -n ' httpd'; /usr/sbin/httpd ${httpd_flags}
  547. fi
  548. if [ X"${ftpd_flags}" != X"NO" ]; then
  549. echo -n ' ftpd'; /usr/libexec/ftpd ${ftpd_flags}
  550. fi
  551. if [ X"${ftpproxy_flags}" != X"NO" ]; then
  552. echo -n ' ftp-proxy'; /usr/sbin/ftp-proxy ${ftpproxy_flags}
  553. fi
  554. if [ X"${identd_flags}" != X"NO" ]; then
  555. echo -n ' identd'; /usr/libexec/identd ${identd_flags}
  556. fi
  557. if [ X"${inetd}" = X"YES" -a -e /etc/inetd.conf ]; then
  558. echo -n ' inetd'; inetd
  559. fi
  560. if [ X"${sshd_flags}" != X"NO" ]; then
  561. echo -n ' sshd'; /usr/sbin/sshd ${sshd_flags};
  562. fi
  563. if [ X"${spamd_flags}" != X"NO" ]; then
  564. if [ X"${spamd_grey}" != X"NO" ]; then
  565. spamd_flags="${spamd_flags} -g"
  566. fi
  567. echo -n ' spamd'; eval /usr/libexec/spamd ${spamd_flags}
  568. /usr/libexec/spamd-setup
  569. if [ X"${spamd_grey}" != X"NO" ]; then
  570. echo -n ' spamlogd'
  571. /usr/libexec/spamlogd ${spamlogd_flags}
  572. fi
  573. fi
  574. if [ X"${rarpd_flags}" != X"NO" -a -s /etc/ethers ]; then
  575. echo -n ' rarpd'; rarpd ${rarpd_flags}
  576. fi
  577. if [ X"${bootparamd_flags}" != X"NO" -a -s /etc/bootparams ]; then
  578. echo -n ' rpc.bootparamd'; rpc.bootparamd ${bootparamd_flags}
  579. fi
  580. if [ X"${rbootd_flags}" != X"NO" -a -s /etc/rbootd.conf ]; then
  581. echo -n ' rbootd'; rbootd ${rbootd_flags}
  582. fi
  583. if [ X"${mopd_flags}" != X"NO" -a -d /tftpboot/mop ]; then
  584. echo -n ' mopd'; mopd ${mopd_flags}
  585. fi
  586. echo '.'
  587. mixerctl_conf
  588. # KerberosV master KDC
  589. if [ X"${krb5_master_kdc}" = X"YES" ]; then
  590. echo 'KerberosV master KDC'
  591. /usr/libexec/kdc &
  592. /usr/libexec/kadmind &
  593. /usr/libexec/kpasswdd &
  594. fi
  595. # KerberosV slave KDC
  596. if [ X"${krb5_slave_kdc}" = X"YES" ]; then
  597. echo 'KerberosV slave KDC'
  598. /usr/libexec/kdc &
  599. # Remember to enable hpropd in inetd.conf
  600. fi
  601. [ -f /etc/rc.local ] && . /etc/rc.local
  602. echo -n standard daemons:
  603. if [ X"${apmd_flags}" != X"NO" -a -x /usr/sbin/apmd ]; then
  604. echo -n ' apmd'; /usr/sbin/apmd ${apmd_flags}
  605. fi
  606. if [ X"${acpid_flags}" != X"NO" -a -x /usr/sbin/acpid ]; then
  607. echo -n ' acpid'; /usr/sbin/acpid ${acpid_flags}
  608. fi
  609. if [ X"${sensorsd_flags}" != X"NO" ]; then
  610. echo -n ' sensorsd'; /usr/sbin/sensorsd ${sensorsd_flags}
  611. fi
  612. if [ X"${hotplugd_flags}" != X"NO" -a -x /usr/sbin/hotplugd ]; then
  613. echo -n ' hotplugd'; /usr/sbin/hotplugd ${hotplugd_flags}
  614. fi
  615. if [ X"${watchdogd_flags}" != X"NO" -a -x /usr/sbin/watchdogd ]; then
  616. echo -n ' watchdogd'; /usr/sbin/watchdogd ${watchdogd_flags}
  617. fi
  618. echo -n ' cron'; cron
  619. # disable carp interlock
  620. ifconfig -g carp -carpdemote 128
  621. echo '.'
  622. date
  623. if [ X"${wsmoused_flags}" != X"NO" -a -x /usr/sbin/wsmoused ]; then
  624. echo 'starting wsmoused...'; /usr/sbin/wsmoused ${wsmoused_flags}
  625. fi
  626. # Alternatively, on some architectures, xdm may be started in /etc/ttys.
  627. if [ X"${xdm_flags}" != X"NO" ]; then
  628. echo 'starting xdm...'; /usr/X11R6/bin/xdm ${xdm_flags}
  629. fi
  630. exit 0