Xref: utzoo comp.mail.misc:1056 news.sysadmin:778 Path: utzoo!attcan!uunet!lll-winken!lll-tis!helios.ee.lbl.gov!pasteur!ucbvax!decwrl!palo-alto!vixie From: vixie@palo-alto.DEC.COM (Paul Vixie) Newsgroups: comp.mail.misc,news.sysadmin Subject: Re: My script for mapfiles/pathalias updating Keywords: pathalias, maps, update, script Message-ID: <3238@palo-alto.DEC.COM> Date: 28 Jun 88 21:23:41 GMT References: <957@flatline.UUCP> <320@elan.UUCP> Organization: DEC Western Research Lab Lines: 47 In article <320@elan.UUCP> jlo@elan.UUCP (Jeff Lo) writes: # In article <957@flatline.UUCP> erict@flatline.UUCP (j eric townsend) writes: # ># This pulls the maps from their spool/news directory, cleans them # ># up, and puts them into the map directory... # ># LastCheck is an empty file that I use as a date-keeper for the # ># last time the spool directory was checked for new maps. # > # >touch /usr/lib/mail/maps/LastCheck # > # >Anyone who thinks they can do this better, please post your script. # # Your script is very similar to the one I use here, the major difference # being that I keep two time stamp files. I touch one (the new time stamp) # *before* I start extracting the maps, then use "-newer" on the other one (the # old time stamp). When I am done, I move the new time stamp to the old one. # This way, if news happens to be coming in while I am extracting the maps # there is no race between find and rnews. Better to get a map twice than # not at all. I hacked up 'uuhosts -unbatch' to do a touch /usr/spool/uucpmap/comp.mail.maps/.time_stamp every time it unpacked a map article; then I wrote a Makefile for /usr/lib/mail that has paths.dir and paths.pag depending on paths which depends on the .time_stamp file. At 12:30am every night I run 'cd /usr/lib/mail;make', which rebuilds the paths database if any map articles have been unpacked since the last time the paths database was built. It's actually a little more complicated, of course. I depend on path.local and glue.local, and rebuild the paths database if either of these changes also. I had thought to build a bunch of Makefile dependencies based on the map files themselves, but I kept scrogging the Makefile :-(. So I hacked uuhosts as described above and use a static Makefile. Note that I do not use uuhosts -index or uuhostsfor host lookups. The "findhost" package is muchly better and faster for this. Uuhosts is great for unpacking the maps, though. Unshar by itself will still exec a /bin/sh once it has the headers out of the way; uuhosts execs a program called "mapsh" which does a chroot(2) and then execs the real /bin/sh. So if someone puts "rm -rf /" in a comp.mail.maps article, the most I can lose is the contents of /usr/spool/uucpmap. I keep meaning to package all this stuff back up with my various hacks and some documentation... someday... sigh... -- Paul Vixie Digital Equipment Corporation Work: vixie@dec.com Play: paul@vixie.UUCP Western Research Laboratory uunet!decwrl!vixie uunet!vixie!paul Palo Alto, California, USA +1 415 853 6600 +1 415 864 7013