From mboxrd@z Thu Jan 1 00:00:00 1970 Message-Id: <200302152301.h1FN16M07647@augusta.math.psu.edu> To: 9fans@cse.psu.edu MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0" Content-ID: <7641.1045350044.0@augusta.math.psu.edu> From: Dan Cross Subject: [9fans] A modified version of /rc/bin/C Date: Sat, 15 Feb 2003 18:01:06 -0500 Topicbox-Message-UUID: 625f26bc-eacb-11e9-9e20-41e7f4b1d025 ------- =_aaaaaaaaaa0 Content-Type: text/plain; charset="us-ascii" Content-ID: <7641.1045350044.1@augusta.math.psu.edu> A while back, I couldn't figure out why my `C' command couldn't find the consoles on my console server. Russ was quick to point out that I needed to mount /srv/consoles in namespace.$sysname. However, I didn't like that because it seemd like something one shouldn't *need* to do. Instead, I modified C to import '#s' from the console server, and mount '#s/consoles' directly on the client. I like this better, since C now works everywhere, without any sort of dependencies on the namespace from the server. Another thing that bothered me about /rc/bin/C was that one needed to modify it to explicitly set one's console server. That struck me as kind of bogus; shouldn't there be a more systematic way to do it? So today, I modified /rc/bin/C on my system to get the name of the console server using ndb/ipquery. This way, I can set up multiple console servers all over the network, and tell C where they are by putting console=foo paits into /lib/ndb/local and friends. This is much easier, in my opinion, than putting local policy into a script in /rc/bin. It also makes maintenance of C itself easier (not that it really needs to be maintained all that much; it's a pretty simple script). Using ndb/ipquery makes it sensative to what network I'm on, and allows me to set a default. Anyway, here's my version; Russ, how would you feel about putting this into the distribution? - Dan C. ------- =_aaaaaaaaaa0 Content-Type: text/plain; charset="us-ascii" Content-ID: <7641.1045350044.2@augusta.math.psu.edu> #!/bin/rc rfork n switch($1){ case -r shift opt='' case * opt=-r } # change to console server # may want to use a switch on the # machine name to support multiple # console servers server=`{ndb/ipquery sys $1 console | sed 's/console=//'} if (~ $server '') server=$sysname if(! test -e /mnt/consoles/$1){ switch($sysname){ case $server mount /srv/consoles /mnt/consoles case * mntgen import $server '#s' /n/$server^srv mount /n/$server^srv/consoles /mnt/consoles } } if(! test -e /mnt/consoles/$1 && test -e /srv/consoles) mount /srv/consoles /mnt/consoles if(! test -e /mnt/consoles/$1){ echo console not found exit 'console not found' } con -l $opt /mnt/consoles/$1 ------- =_aaaaaaaaaa0--