C 889 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. #!/bin/rc
  2. rfork n
  3. oflag=()
  4. opt=-r
  5. while(~ $1 -*)
  6. switch($1){
  7. case -r
  8. shift
  9. opt=''
  10. case -O -o
  11. oflag=-O
  12. shift
  13. case *
  14. opt=-r
  15. shift
  16. }
  17. switch($1){
  18. case fs
  19. server=edith
  20. case sources
  21. server=ethel
  22. case ella
  23. exec C office0
  24. exit
  25. case erika
  26. exec C office1
  27. exit
  28. case *
  29. # look for server in /lib/ndb
  30. server=`{ndb/query sys $1 console}
  31. switch($server){
  32. case ''
  33. echo C: unknown console server for $1
  34. exit 1
  35. }
  36. }
  37. # can't cpu to old servers any more
  38. switch($server){
  39. case dinar bones
  40. ssh $server C $1
  41. exit 0
  42. }
  43. if(! test -e /mnt/consoles/$1){
  44. switch($sysname){
  45. case $server
  46. mount /srv/consoles /mnt/consoles
  47. case *
  48. import $oflag $server /mnt/consoles
  49. }
  50. }
  51. if(! test -e /mnt/consoles/$1 && test -e /srv/consoles)
  52. mount /srv/consoles /mnt/consoles
  53. if(! test -e /mnt/consoles/$1){
  54. echo console not found
  55. exit 'console not found'
  56. }
  57. con -l $opt /mnt/consoles/$1