Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!rice!sun-spots-request From: bwc!bob@uunet.uu.net (Bob Gregory) Newsgroups: comp.sys.sun Subject: Re: Printcap for a large site; how??? Keywords: Miscellaneous Message-ID: <5314@brazos.Rice.edu> Date: 26 Feb 90 03:46:50 GMT Sender: root@rice.edu Organization: Sun-Spots Lines: 148 Approved: Sun-Spots@rice.edu X-Refs: Original: v9n50 X-Sun-Spots-Digest: Volume 9, Issue 59, message 10 In article <5067@brazos.Rice.edu> pwa-b!m086414 (Fred Comins) writes: >X-Sun-Spots-Digest: Volume 9, Issue 50, message 2 > >We have many printers and are getting another 45 laser jets. The problem >is that all users want to be able to get to any of the printers. I'm >looking for advice on the easiest way to keep this managed. Currently we >were planning to use rdist with 1 master printcap with an entry for every >printer. Any better ideas? Do I have to have a spool directory for each? I tried to respond to the sender, but mail bounced, and meanwhile I've seen no response posted. Although the solution described here is not especially Sun-specific, other Sun sites with central administration of a number of similarly configured systems may find this useful. We have ~40 printers on ~20 Suns (so far). We also need to allow promiscuous printing. Deciding which printers need access from which hosts is usually more trouble than it's worth. We keep a "master" directory on a server which maintains all our printcaps. You do have to create separate spooling directories for each printer, so this directory has a sub-directory which is a "master" copy of (virgin) /{usr|var}/spool/lpd. Bad owner/modes on the spooling directory is a common mistake, so a script creates new directories there with the right modes and ownership, and this is propagated by rdist(1) along with the printcaps. If the modes get munged later, rdist will gripe about the mismatch. This has cured chronic "broken" spoolers (and found a few "fixed" with mode 777). Our README from this directory: This tree maintains /etc/printcap and the lpd(8) spooling directories across the network. printcaps for host machines of interest are the files [a-z]* in this directory. Scripts, Distfiles, or Subdirectories (e.g. Lpd) are by convention MixedCase. corollary: echo [a-z]* shows machines which may be considered. (remove editor backups or expect grumbles). to add a new host touch newhost or if it has a meaningful printcap rcp newhost:/etc/printcap ./newhost printcap files may have a host-specific part at the beginning followed by the common part. the host-specific part is required for the machine which actually spools to the printer. the common part makes printers known to other hosts for remote spooling. Adding a new printer needs a new entry in the printcap file of the host which has the printer attached. The lpr(1), etc. ignore later duplicate printcap entries, so the host-specific stuff is at the beginning of the file. Changes after the header of the Common file will be lost. Entries in Common should be created with the :rp: capability (keep all aliases the same, please). Common - defines all printers as remote. Alter this file when adding or removing printers, or changing aliases. Edit - integrate Common into all [ or a few ] printcap files. Usage: Edit [ host ... ] Makedir - create new spooling directories under Lpd to be propagated with rdist(1) via Install Usage: Makedir newlpdir [ newlpdir ... ] Install - propagate printcap and spooling directories to all [ or a few ] hosts. (hosts up? try rup(1)) Usage: Install [ host ... ] --------------- Install ------------- #!/bin/csh -f cd /usr/rdist/printcap # or wherever we are... if $#argv > 1 then set hosts = ( $* ) else set hosts = ( [a-z]* ) endif foreach host ( $hosts ) rdist -f Distfile.install -d HOST=$host -d FILE=$cwd/$host ### end rdist -f Distfile.lpd -d HOSTS="($hosts)" ------------- Edit ------------- #!/bin/csh -f cd /usr/rdist/printcap # or wherever we are... if $#argv > 1 then set hosts = ( $* ) else set hosts = ( [a-z]* ) endif foreach host ( $hosts ) awk '/common printcap/ { exit } { print }' $host > /tmp/Edit.$$ cat /tmp/Edit.$$ Common > $host end rm -f /tmp/Edit.$$ ----- Common looks something like this ----- # common printcap (don't mess with this line) # lp_mrf|mrf|Master Reference Files matrix:\ :lp=:rm=orb:rp=mrf:sd=/usr/spool/lpd/mrf:lf=/usr/adm/lpderrs: lp_lib|lib|Library Laser:\ :lp=:rm=nova:rp=lib:sd=/usr/spool/lpd/lib:lf=/usr/adm/lpderrs: ...etc... ------------- Makedir ------------ #!/bin/csh -f cd /usr/rdist/printcap/Lpd # master spooling directory foreach nudir ( $* ) if ( -d $nudir ) then echo "$nudir already exists!" else mkdir $nudir endif chown daemon.daemon $nudir && chmod 770 $nudir ls -ldg $nudir end ---------------- Distfiles called by Install --------------- Distfile.install: ${FILE} -> ${HOST} install /etc/printcap ; # optional -y , see note below Distfile.lpd: /usr/rdist/printcap/Lpd -> ${HOSTS} install /usr/spool/lpd ; NOTE: if local editing is permitted on the remotes, consider the -y flag to rdist(1), and run Install both before and after editing. Have also used the above technique for administering various other "local" files, when there is enough in common, or interrelationship, to warrant it. We usually do /etc/fstab this way. Changes to exported filesystems are more frequent than local ones, and always affect several systems (servers have clients). Most of the /etc/passwd files are identical (we use YP), and it's handy to change the root password everywhere at once. I believe this should scale well to larger networks with similar needs for centralized maintenance.