cpurc 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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 = helix # 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. # if we're not a server, start a dns resolver
  23. if(! test -e /srv/dns)
  24. ndb/dns -r
  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 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. #
  35. # also rename some files:
  36. #
  37. # if(! test -e /rc/bin/service.auth/tcp567){
  38. # mv /rc/bin/service.auth/authsrv.il566 /rc/bin/service.auth/il566
  39. # mv /rc/bin/service.auth/authsrv.tcp567 /rc/bin/service.auth/tcp567
  40. # mv /rc/bin/service/il566 /rc/bin/service/_il566
  41. # mv /rc/bin/service/tcp567 /rc/bin/service/_tcp567
  42. # }
  43. # start listeners if it hasn't already been done (dicey check)
  44. if(! netstat -n | grep -s 'tcp.*Listen.* (7|9|21|22|23|25|110|113|565|993|17007|17009|17010) .*')
  45. aux/listen -q tcp
  46. # we don't use IL, maybe you do
  47. if(! netstat -n | grep -v 17008 | grep -s il.*Listen)
  48. aux/listen -q il
  49. if(! ps|grep -s timesync) {
  50. aux/timesync -n pool.ntp.org
  51. if (test -e '#r/rtc') @ {
  52. sleep 10 # let timesync correct the time
  53. awk '{print $1}' /dev/time >'#r/rtc' # fix hw clock
  54. } &
  55. }
  56. # cpu-specific late startup
  57. if(test -e /cfg/$sysname/cpustart)
  58. . /cfg/$sysname/cpustart
  59. # echo `{date} $sysname >>/sys/log/boot
  60. exit ''