cpurc 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. #!/bin/rc
  2. # cpu server start up
  3. date > /env/boottime
  4. # mount points
  5. mntgen -s slashn && chmod 666 /srv/slashn
  6. # name translation, cs sets /dev/sysname
  7. ndb/cs
  8. sysname=`{cat /dev/sysname}
  9. # parallelism for mk
  10. NPROC = `{wc -l </dev/sysstat}
  11. # site-specific startup
  12. if(test -e /rc/bin/cpurc.local)
  13. . /rc/bin/cpurc.local
  14. if (~ $#sysname 0 || ~ $sysname '') {
  15. sysname = harvey # default
  16. echo -n $sysname >/dev/sysname
  17. }
  18. prompt=($sysname^'# ' ' ')
  19. # cpu-specific startup
  20. if(test -e /cfg/$sysname/cpurc)
  21. . /cfg/$sysname/cpurc
  22. # start up internet if we don't already have an address
  23. if(! grep u /net/ipselftab | grep -sv 127.0.0.1)
  24. ip/ipconfig
  25. if(! grep -s 127.0.0.1 /net/ipselftab)
  26. ip/ipconfig loopback /dev/null 127.1
  27. # if we're not a server, start a dns resolver
  28. if(! test -e /srv/dns)
  29. ndb/dns -r
  30. # If you are on an auth server, start these before listening:
  31. #
  32. # auth/keyfs -wp -m /mnt/keys /adm/keys >/dev/null >[2=1]
  33. auth/cron >>/sys/log/cron >[2=1] &
  34. # keep other bootes processes from creating capabilities
  35. rm -f '#¤/caphash'
  36. # also rename some files on an auth server:
  37. #
  38. # if(! test -e /rc/bin/service.auth/tcp567){
  39. # mv /rc/bin/service.auth/authsrv.il566 /rc/bin/service.auth/il566
  40. # mv /rc/bin/service.auth/authsrv.tcp567 /rc/bin/service.auth/tcp567
  41. # mv /rc/bin/service/il566 /rc/bin/service/_il566
  42. # mv /rc/bin/service/tcp567 /rc/bin/service/_tcp567
  43. # }
  44. # netssh
  45. # start listeners if it hasn't already been done (dicey check)
  46. if(! netstat -n | grep -s 'tcp.*Listen.* (7|9|21|22|23|25|110|113|565|993|17007|17009|17010) .*')
  47. aux/listen -q tcp
  48. if(! ps|grep -s timesync) {
  49. aux/timesync -n pool.ntp.org
  50. if (test -e '#r/rtc') @ {
  51. sleep 10 # let timesync correct the time
  52. field 1 /dev/time >'#r/rtc' # fix hw clock
  53. } &
  54. }
  55. # cpu-specific late startup
  56. if(test -e /cfg/$sysname/cpustart)
  57. . /cfg/$sysname/cpustart
  58. # mode of /proc/*/ctl is inherited across rfork, and sets modes on
  59. # other /proc files, such as note, so let listen be killed.
  60. #dontkill '^(ipconfig|factotum|mntgen|venti|fossil|cs|dns|reboot)$'
  61. #aux/listen1 -t -v tcp!*!1522 /bin/aux/pipeconsole /bin/rc -m /rc/lib/rcmain -i &
  62. #aux/comconsole '#t/eia0' /bin/rc -m/rc/lib/rcmain -i &
  63. echo 'key proto=p9sk1 dom=harvey user=harvey !password=harvey' >/mnt/factotum/ctl
  64. aux/listen1 -t tcp!*!6666 /bin/cpu -R &
  65. # echo `{date} $sysname >>/sys/log/boot
  66. exit ''