C 855 B

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