cpurc 2.3 KB

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