home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1993 July / Internet Tools.iso / RockRidge / mail / smail-3.1.28 / guide / admin / utilities < prev    next >
Encoding:
Text File  |  1990-10-23  |  9.2 KB  |  316 lines

  1. .\" @(#)guide/admin/utilities    1.2 10/24/90 05:17:59
  2. .NH
  3. Basics of Using the Smail Utilities
  4. .PP
  5. There are a fairly large number of utility programs that are included
  6. in the
  7. .B Smail3.1
  8. release.  Most of these utilities are useful in creating, maintaining
  9. and displaying databases which can be used by smail for directing and
  10. routing.  These database manipulation tools are layered such that a
  11. small set of low-level utilities are available for creating databases
  12. in various formats, such as sorted files or DBM files (using the
  13. .I dbm (3X)
  14. library).  In addition, the
  15. .B mkline
  16. and
  17. .B pathalias
  18. tools can be used in formatting raw alias and path data for use by
  19. the database creation tools.  Built on top of these lower level tools
  20. are configuration-driven tools such as
  21. .B mkaliases
  22. and
  23. .B mkpath ,
  24. which handle things at a higher level.
  25. .PP
  26. Most of these smail utilities are installed under the smail library
  27. directory, which is normally
  28. .I /usr/lib/smail .
  29. .NH 2
  30. Building Simple Databases
  31. .PP
  32. Sorted databases, and
  33. .I dbm -based
  34. databases, can be used by smail directors based on the aliasfile
  35. driver or by routers based on the pathalias driver.  The first command
  36. to know about when creating these databases is
  37. .B mkline .
  38. This command takes an alias file or path file as input, strips
  39. comments and unnecessary white-space, and joins continuation lines.
  40. For example, given the alias file:
  41. .DS I
  42. .ta .5i 3i
  43. # Sample alias file
  44. Postmaster:
  45.     tron@futatsu    # Ronald S. Karr
  46.     chongo@eek    # Landon Noll
  47. .sp \n(PDu
  48. uucp:    gam@woof    # Gordon Moffett
  49. .TA
  50. .DE
  51. the
  52. .B mkline
  53. command would produce, on its standard output:
  54. .DS I
  55. Postmaster:tron@futatsu chongo@eek
  56. uucp:gam@woof
  57. .DE
  58. .PP
  59. By removing comments and continuation lines, programs that create
  60. databases can read single line records.
  61. .PP
  62. Sorted databases can be created using either the
  63. .B sort
  64. command or the smail
  65. .B mksort
  66. utility.
  67. .B Mksort
  68. does not have any line length restrictions, and can thus be used for
  69. aliases and paths containing arbitrarily large records.  It does
  70. require the ability to read all of its input files into memory.  In
  71. addition, some versions of the
  72. .B sort
  73. command are reported to have a bug related to the use of the
  74. .B \-f
  75. flag, for performing case-independent sorting.  To creat a sorted
  76. version of the alias file listed above, use the following command:
  77. .DS I
  78. mkline \fIaliasfile\fP | mksort \-f > \fIaliasfile\fP.sort
  79. .DE
  80. Here,
  81. .I aliasfile
  82. is the pathname containing the file of interest.  The
  83. .B \-f
  84. flag performs a sort in a case-independent manner, as required for the
  85. smail
  86. .B bsearch
  87. file lookup method.  This command line could also be used to create a
  88. sorted paths file.  Smaller systems may wish to use
  89. .B sort
  90. to avoid high memory usage, or errors due to running out of memory.
  91. Path files can be quite large.
  92. .PP
  93. DBM databases can be created using the
  94. .B mkdbm
  95. utility.  To create a database can be used by the smail
  96. .B dbm
  97. file lookup method, for aliasfile directors and pathalias routers, use
  98. a command such as:
  99. .DS I
  100. mkline \fIfile\fP | mkdbm \-f -o \fIname\fP
  101. .DE
  102. where
  103. .I file
  104. is the source text for the database and
  105. .I name
  106. is the name for the DBM database.  This will create two files,
  107. .I name .pag
  108. and
  109. .I name .dir
  110. containing the actual data.  The
  111. .B \-f
  112. flag causes the keys to be converted to lower case before being stored
  113. in the database.
  114. .PP
  115. Rather than require that you enter a complex command every time you
  116. have changed the primary
  117. .I aliases
  118. file, the
  119. .B mkaliases
  120. utility exists to do this for you.  It uses the configuration defined
  121. in the EDITME file to determine how your aliases file is to be built,
  122. and where it is to be found, and builds it for you.  For example, if
  123. your alias database is stored as a DBM file with a name of
  124. .I /usr/lib/aliases ,
  125. then the command
  126. .DS I
  127. mkaliases
  128. .DE
  129. will execute the shell command:
  130. .DS I
  131. mkline /usr/lib/aliases | mkdbm -f -v -o /usr/lib/aliases
  132. .DE
  133. .NH 2
  134. Building Path Databases
  135. .PP
  136. Quite often, the building of path databases is more complex than
  137. taking one file and running it through a mkline|mksort or a
  138. mkline|mkdbm pipeline.  Map data is often used, which must be
  139. processed by the
  140. .B pathalias
  141. program to produce paths.  As well, this map data can come from a
  142. variety of sources, both from map data published monthly in the USENET
  143. newsgroup
  144. .B comp.mail.maps
  145. and from private sources, such as maps of local area networks, or
  146. a private map entry for the local host.
  147. .PP
  148. The
  149. .B mkpath
  150. utility is used to organize the path building process.  It takes a
  151. configuration file, describing where map files can be found, along
  152. with directives controlling other data, and feeds all of this to
  153. pathalias.  It produces paths on the standard output.
  154. .PP
  155. An example of a configuration file for mkpath is the following file,
  156. .I world.conf :
  157. .DS I
  158. .ta \w'safemap'u+3n
  159. # get the usenet world maps
  160. cd      /usr/spool/uumaps
  161. safemap d.*
  162. safemap u.*
  163. .sp \n(PDu
  164. # merge in the new maps
  165. cd      /usr/lib/smail/maps
  166. safemap newmap/*.map
  167. .sp \n(PDu
  168. # merge in our external map
  169. delete  `uuname -l`
  170. map     world.map private.map tweak.map
  171. .TA
  172. .DE
  173. The configuration file above takes map files beginning with
  174. .I d.
  175. and
  176. .I u.
  177. from the directory
  178. .I /usr/spool/uumaps ,
  179. and map files under
  180. .I /usr/lib/smail/maps/newmap .
  181. These map files are sent as input to pathalias, the name of the local
  182. host is deleted from the connectivity information that pathalias has
  183. collected, and then the files
  184. .I world.map ,
  185. .I private.map
  186. and
  187. .I tweak.map
  188. are sent to pathalias.  The reason for deleting the local host
  189. connectivity information is that links from the local host should not
  190. be determined based on information in the maps published by other
  191. sites.  After processing all of this, a sorted list of path file
  192. entries is written to the standard output.  The above configuration
  193. file could be used to create a sorted paths file using the command:
  194. .DS I
  195. mkpath world.conf > world.path
  196. .DE
  197. A complete set of examples is distributed with smail in the source
  198. directory
  199. .I samples/amdahl/maps .
  200. .NH 2
  201. Storing and Displaying Information about Hosts
  202. .PP
  203. The
  204. .B uuwho
  205. command can be used by users or site administrators to get a listing
  206. of the map entry for a known site.  It makes use of a database which
  207. is formed by the
  208. .B mkuuwho
  209. command.  Mkuuwho takes a mkpath configuration file and produces a
  210. database which associates each site name with the location of the
  211. map entry for that site.  The mkpath configuration file is used only
  212. for determining where the map files are to be found.
  213. .PP
  214. With the configuration file used above as an example for
  215. .B mkpath ,
  216. the following command can be used to create an accompanying uuwho
  217. database:
  218. .DS I
  219. mkuuwho -u uuwho world.conf
  220. .DE
  221. This will create a DBM database, in the files
  222. .I uuwho.pag
  223. and
  224. .I uuwho.dir .
  225. After the database is created, the command:
  226. .DS I
  227. uuwho foobar
  228. .DE
  229. could be used to display a map entry such as:
  230. .DS I
  231. .ta \w'Postal Address'u+3n
  232. System name:    foobar
  233. Organization:    Foo Bar, Inc.
  234. System type:    pdp 11/45, v6 modified
  235. Contact person:    Joe Stud, III
  236. Email Address:    foobar!stud3
  237. Telephone:    +1 605 555 2175
  238. Postal Address:    Foo Bar, Inc., Wall SD 57790
  239. Long/Lat:    44 00 43 N / 102 19 59 W
  240. News links:    namei glotz hoptoad kgbvax kremvax
  241. .sp \n(PDu
  242. #
  243. #    upstream sites
  244. .sp \n(PDu
  245. .ta \w'foobar'u+3n
  246. foobar    glotz(HOURLY+LOW), namei(HOURLY+HIGH)
  247. #
  248. #    downstream sites
  249. foobar    kgbvax(HOURLY*4), kremvax(HOURLY*4)
  250. #
  251. #    our alt.drugs feed
  252. foobar    hoptoad(DAILY)
  253. .TA
  254. .DE
  255. .NH 2
  256. Extracting Maps From USENET
  257. .PP
  258. The
  259. .B getmap
  260. utility can be used to extract map entries from the maps published in
  261. the USENET newsgroup
  262. .B comp.mail.maps .
  263. To use this utility with netnews version 2.11, for automated map
  264. extraction, first put the following line into your news
  265. .I sys
  266. file:
  267. .DS I
  268. maps:comp.mail.maps,world:F:/usr/spool/uumaps/work/batch
  269. .DE
  270. This line will cause netnews to put a line in
  271. .I /usr/spool/uumaps/work/batch
  272. every time an article is posted to the
  273. .B comp.mail.maps
  274. newsgroup.  This line contains the pathname to the article file.
  275. .PP
  276. Periodically, the
  277. .B getmap
  278. utility can be executed to process the
  279. .I batch
  280. file, extracting any map data that has been received.  Getmap should
  281. be executed from cron under a user and group that can write to the map
  282. directory,
  283. .I /usr/spool/uumaps .
  284. It will mail any errors to the address
  285. .B postmaster .
  286. The period of execution should preclude the loss of any map data as a
  287. result of a articles being expired, but does not necessarily need to
  288. be daily.
  289. .NH 2
  290. Smail Cleanup Utilities
  291. .PP
  292. As discussed in a previous section, the utilities
  293. .B checkerr
  294. and
  295. .B savelog
  296. exist to clean up after smail.  The
  297. .B checkerr
  298. utility checks for processing errors, sending errors to the mail
  299. administrator whenever they are found.  The
  300. .B savelog
  301. utility can be used to perform log truncation and compression, so that
  302. the filesystem containing the smail logfile does not eventually fill
  303. up.  Both of these utilities should be executed on a daily basis from
  304. cron.
  305. .PP
  306. The
  307. .B getmap
  308. utility also keeps a log of its activities, in the file
  309. .I /usr/spool/uumaps/work/getmap.log .
  310. Sites that use this utility to extract maps from USENET should use the
  311. .B savelog
  312. utility to truncate and compress this log as well.  However, this
  313. should not grow very quickly, so a running the necessary savelog
  314. command on a monthly basis is reasonable, particularly since this is
  315. the period over which map data is published.
  316.