Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!cmcl2!phri!roy From: roy@phri.UUCP (Roy Smith) Newsgroups: comp.unix.wizards Subject: Re: distributed /etc/printcap Message-ID: <2902@phri.UUCP> Date: Sun, 20-Sep-87 22:13:44 EDT Article-I.D.: phri.2902 Posted: Sun Sep 20 22:13:44 1987 Date-Received: Mon, 21-Sep-87 04:31:21 EDT References: <81900001@sfu_cmpt> Reply-To: roy@phri.UUCP (Roy Smith) Organization: Public Health Research Inst. (NY, NY) Lines: 66 Summary: Use the Yellow Pages (achk, gag!) In article <81900001@sfu_cmpt> stevec@sfu_cmpt.cs.sfu describes how some of his 50-odd Suns have private /etc/printcaps, and some share a common /etc/printcap via NFS, and the problems therein. We took a different approach. We (actually I had little to do with it; phri!nomi did all the hard work) hacked up lpr to use the Yellow Pages. BTW, printcap seems like such a natural for YP that I'm really surprised that Sun doesn't ship systems with it already set up. All of the lpr suite of programs now know to look in the local /etc/printcap first to resolve a printer name and then to query the YP. Thus, we list all our printers in the YP and for each host which actually has a printer, we put an entry in the local /etc/printcap for the printer. Most hosts don't have local printers so they don't have /etc/printcaps at all (or zero-length ones) For example, our YP has the following entry: laser9|ps9: \ :lp=:rm=adenine:rp=laser9:\ :sd=/usr/spool/laser9:lf=/usr/spool/laser9/log: but adenine's /etc/printcap looks like: laser9|ps9:\ :lp=:rm=phri:rp=laser10:\ :sd=/usr/spool/laser9:\ :lf=/usr/spool/laser9/log: #laser9|ps9|postscript|PostScript:\ # :lp=/dev/ttya:sd=/usr/spool/laser9:\ # :lf=/usr/spool/laser9/log:af=/usr/adm/laser9.acct:\ # :br#9600:rw:fc#0000374:fs#0000003:xc#0:xs#0040040:mx#0:sf:sb:\ # :if=/usr/local/lib/ps/psif:\ # :of=/usr/local/lib/ps/psof:gf=/usr/local/lib/ps/psgf:\ # :nf=/usr/local/lib/ps/psnf:tf=/usr/local/lib/ps/pstf:\ # :rf=/usr/local/lib/ps/psrf:vf=/usr/local/lib/ps/psvf:\ # :cf=/usr/local/lib/ps/pscf:df=/usr/local/lib/ps/psdf: Actually, I happened to pick an example which is a bit more interesting than I intended, but illustrates something worth talking about. Usually, adenine's /etc/printcap is just the commented out entry. It just so happens that laser9 is down for a few days right now so we're rerouting jobs sent there to laser10, which is on host "phri". It's not very efficient (the jobs get sent to adenine, which then turns them around and ships them to phri), but it's only for a few days and we're willing to put up with the extra network traffic for a while in return for the administrative convenience. The efficient alternative would have been to change the YP entry for laser9 to point to phri:laser10, but then I would have had to change the local entry on adenine as well. One minor wart in this approach. We use /etc/printcap on our master YP server as the source for the YP printcap map. Since a machine with a local printer needs a printcap entry for that printer different from what's in the YP map, this only works as long as we don't have a printer on our master YP server. If we ever do that, we'll have to switch over to keeping the map source file someplace other than /etc/printcap. Please do not construe my advocacy of YP in this situation to mean that I think YP is any more than an ugly hack. The idea is nice, but the implementation is disgusting. I've seen YP programs fail in all sorts of strange and wonderful (and decidedly non-intuitive) ways. For example, "getpwuid (getuid)" can fail (with errno set to all sorts of non-informative things) if you don't have things set up properly. -- Roy Smith, {allegra,cmcl2,philabs}!phri!roy System Administrator, Public Health Research Institute 455 First Avenue, New York, NY 10016