op.me
来自「<B>Digital的Unix操作系统VAX 4.2源码</B>」· ME 代码 · 共 2,890 行 · 第 1/5 页
ME
2,890 行
(it will not even time out!)..ip nThis file is created when an id is being created.It is a separate file to insure that no mail can ever be destroyeddue to a race condition.It should exist for no more than a few millisecondsat any given time..ip qThe queue control file.This file contains the information necessary to process the job..ip tA temporary file.These are an image of the.b qffile when it is being rebuilt.It should be renamed to a.b qffile very quickly..ip xA transcript file,existing during the life of a sessionshowing everything that happensduring that session..ppThe.b qffile is structured as a series of lineseach beginning with a code letter.The lines are as follows:.ip DThe name of the data file.There may only be one of these lines..ip HA header definition.There may be any number of these lines.The order is important:they represent the order in the final message.These use the same syntaxas header definitions in the configuration file..ip RA recipient address.This will normally be completely aliased,but is actually realiased when the job is processed.There will be one linefor each recipient..ip SThe sender address.There may only be one of these lines..ip TThe job creation time.This is used to compute when to time out the job..ip PThe current message priority.This is used to order the queue.Higher numbers mean lower priorities.The priority increasesas the message sits in the queue.The initial priority depends on the message classand the size of the message..ip MA message.This line is printed by the.i mailqcommand,and is generally used to store status information.It can contain any text..ppAs an example,the following is a queue file sent to.q mckusick@calderand.q wnj :.(bDdfA13557SericT404261372P132Rmckusick@calderRwnjH?D?date: 23-Oct-82 15:49:32-PDT (Sat)H?F?from: eric (Eric Allman)H?x?full-name: Eric AllmanHsubject: this is an example messageHmessage-id: <8209232249.13557@UCBARPA.BERKELEY.ARPA>Hreceived: by UCBARPA.BERKELEY.ARPA (3.227 [10/22/82]) id A13557; 23-Oct-82 15:49:32-PDT (Sat)Hphone: (415) 548-3211HTo: mckusick@calder, wnj.)bThis shows the name of the data file,the person who sent the message,the submission time(in seconds since January 1, 1970),the message priority,the message class,the recipients,and the headers for the message..sh 3 "Forcing the queue".pp.i Sendmailshould run the queue automaticallyat intervals.The algorithm is to read and sort the queue,and then to attempt to process all jobs in order.When it attempts to run the job,.i sendmailfirst checks to see if the job is locked.If so, it ignores the job..ppThere is no attempt to insure that only one queue processorexists at any time,since there is no guarantee that a job cannot take foreverto process.Due to the locking algorithm,it is impossible for one job to freeze the queue.However,an uncooperative recipient hostor a program recipientthat never returnscan accumulate many processes in your system.Unfortunately,there is no way to resolve thiswithout violating the protocol..ppIn some cases,you may find that a major host going downfor a couple of daysmay create a prohibitively large queue.This will result in.i sendmailspending an inordinate amount of timesorting the queue.This situation can be fixed by moving the queue to a temporary placeand creating a new queue.The old queue can be run later when the offending host returns to service..ppTo do this,it is acceptable to move the entire queue directory:.(bcd /usr/spoolmv mqueue omqueue; mkdir mqueue; chmod 777 mqueue.)bYou should then kill the existing daemon(since it will still be processing in the old queue directory)and create a new daemon..ppTo run the old mail queue,run the following command:.(b/usr/lib/sendmail \-oQ/usr/spool/omqueue \-q.)bThe.b \-oQflag specifies an alternate queue directoryand the.b \-qflag says to just run every job in the queue.If you have a tendency toward voyeurism,you can use the.b \-vflag to watch what is going on..ppWhen the queue is finally emptied,you can remove the directory:.(brmdir /usr/spool/omqueue.)b.sh 2 "The Alias Database".ppThe alias database exists in two forms.One is a text form,maintained in the file.i /usr/lib/aliases.The aliases are of the form.(bname: name1, name2, ....)bOnly local names may be aliased;e.g.,.(beric@mit-xx: eric@berkeley.)bwill not have the desired effect.Aliases may be continued by starting any continuation lineswith a space or a tab.Blank lines and lines beginning with a sharp sign(\c.q # )are comments..ppThe second form is processed by the.i dbm \|(3)library.This form is in the files.i /usr/lib/aliases.dirand.i /usr/lib/aliases.pag.This is the form that.i sendmailactually uses to resolve aliases.This technique is used to improve performance..sh 3 "Rebuilding the alias database".ppThe DBM version of the databasemay be rebuilt explicitly by executing the command.(bnewaliases.)bThis is equivalent to giving.i sendmailthe.b \-biflag:.(b/usr/lib/sendmail \-bi.)b.ppIf the.q Doption is specified in the configuration,.i sendmailwill rebuild the alias database automaticallyif possiblewhen it is out of date.The conditions under which it will do this are:.npThe DBM version of the database is mode 666. -or-.np.i Sendmailis running setuid to root..lpAuto-rebuild can be dangerouson heavily loaded machineswith large alias files;if it might take more than five minutesto rebuild the database,there is a chance that several processes will start the rebuild processsimultaneously..sh 3 "Potential problems".ppThere are a number of problems that can occurwith the alias database.They all result from a.i sendmailprocess accessing the DBM versionwhile it is only partially built.This can happen under two circumstances:One process accesses the databasewhile another process is rebuilding it,or the process rebuilding the database dies(due to being killed or a system crash)before completing the rebuild..ppSendmail has two techniques to try to relieve these problems.First, it ignores interrupts while rebuilding the database;this avoids the problem of someone aborting the processleaving a partially rebuilt database.Second,at the end of the rebuildit adds an alias of the form.(b@: @.)b(which is not normally legal).Before sendmail will access the database,it checks to insure that this entry exists\**..(f\**The.q aoption is required in the configurationfor this action to occur.This should normally be specifiedunless you are running.i delivermailin parallel with.i sendmail..)fIt will wait up to five minutesfor this entry to appear,at which point it will force a rebuild itself\**..(f\**Note:the.q Doption must be specified in the configuration filefor this operation to occur..)f.sh 3 "List owners".ppIf an error occurs on sending to a certain address,say.q \fIx\fP ,.i sendmailwill look for an aliasof the form.q owner-\fIx\fPto receive the errors.This is typically usefulfor a mailing listwhere the submitter of the listhas no control over the maintanence of the list itself;in this case the list maintainer would be the owner of the list.For example:.(bunix-wizards: eric@ucbarpa, wnj@monet, nosuchuser, sam@matisseowner-unix-wizards: eric@ucbarpa.)bwould cause.q eric@ucbarpato get the error that will occurwhen someone sends tounix-wizardsdue to the inclusion of.q nosuchuseron the list..sh 2 "Per-User Forwarding (.forward Files)".ppAs an alternative to the alias database,any user may put a file with the name.q .forwardin his or her home directory.If this file exists,.i sendmailredirects mail for that userto the list of addresses listed in the .forward file.For example, if the home directory for user.q mckusickhas a .forward file with contents:.(bmckusick@erniekirk@calder.)bthen any mail arriving for.q mckusickwill be redirected to the specified accounts..sh 2 "Special Header Lines".ppSeveral header lines have special interpretationsdefined by the configuration file.Others have interpretations built into.i sendmailthat cannot be changed without changing the code.These builtins are described here..sh 3 "Return-Receipt-To:".ppIf this header is sent,a message will be sent to any specified addresseswhen the final delivery is complete.if the mailer has the.b lflag (local delivery) set in the mailer descriptor..sh 3 "Errors-To:".ppIf errors occur anywhere during processing,this header will cause error messages to go tothe listed addressesrather than to the sender.This is intended for mailing lists..sh 3 "Apparently-To:".ppIf a message comes in with no recipients listed in the message(in a To:, Cc:, or Bcc: line)then.i sendmailwill add an.q "Apparently-To:"header line for any recipients it is aware of.This is not put in as a standard recipient lineto warn any recipients that the list is not complete..ppAt least one recipient line is required under RFC 822..sh 1 "ARGUMENTS".ppThe complete list of arguments to.i sendmailis described in detail in Appendix A.Some important arguments are described here..sh 2 "Queue Interval".ppThe amount of time between forking a processto run through the queueis defined by the.b \-qflag.If you run in mode.b for.b athis can be relatively large,since it will only be relevantwhen a host that was down comes back up.If you run in.b qmodeit should be relatively short,since it defines the maximum amount of time that a messagemay sit in the queue..sh 2 "Daemon Mode".ppIf you allow incoming mail over an IPC connection,you should have a daemon running.This should be set by your.i /etc/rcfile using the.b \-bdflag.The.b \-bdflag and the.b \-qflag may be combined in one call:.(b/usr/lib/sendmail \-bd \-q30m.)b.sh 2 "Forcing the Queue".ppIn some cases you may find that the queue has gotten clogged for some reason.You can force a queue runusing the.b \-qflag (with no value).It is entertaining to use the.b \-vflag (verbose)when this is done to watch what happens:.(b/usr/lib/sendmail \-q \-v.)b.sh 2 "Debugging".ppThere are a fairly large number of debug flagsbuilt into.i sendmail .Each debug flag has a number and a level,where higher levels means to print out more information.The convention is that levels greater than nine are.q absurd,i.e.,they print out so much information that you wouldn't normallywant to see them except for debugging that particular piece of code.Debug flags are set using the.b \-doption;the syntax is:.(b.ta \w'debug-option 'udebug-flag: \fB\-d\fP debug-listdebug-list: debug-option [ , debug-option ]debug-option: debug-range [ . debug-level ]debug-range: integer | integer \- integerdebug-level: integer.)bwhere spaces are for reading ease only.For example,.(b\-d12 Set flag 12 to level 1\-d12.3 Set flag 12 to level 3\-d3-17 Set flags 3 through 17 to level 1\-d3-17.4 Set flags 3 through 17 to level 4.)bFor a complete list of the available debug flagsyou will have to look at the code(they are too dynamic to keep this documentation up to date)..sh 2 "Trying a Different Configuration File".ppAn alternative configuration filecan be specified using the.b \-Cflag; for example,.(b/usr/lib/sendmail \-Ctest.cf.)buses the configuration file.i test.cfinstead of the default.i /usr/lib/sendmail.cf.If the.b \-Cflag has no valueit defaults to.i sendmail.cfin the current directory..sh 2 "Changing the Values of Options".ppOptions can be overridden using the.b \-oflag.For example,.(b/usr/lib/sendmail \-oT2m.)bsets the.b T(timeout) option to two minutesfor this run only..sh 1 "TUNING".ppThere are a number of configuration parametersyou may want to change,depending on the requirements of your site.Most of these are setusing an option in the configuration file.For example,the line.q OT3dsets option.q Tto the value.q 3d(three days)..sh 2 "Timeouts".ppAll time intervals are setusing a scaled syntax.For example,.q 10mrepresents ten minutes, whereas.q 2h30mrepresents two and a half hours.The full set of scales is:.(b.ta 4ns secondsm minutesh hoursd daysw weeks.)b.sh 3 "Queue interval".ppThe argument to the.b \-qflagspecifies how often a subdaemon will run the queue.This is typically set to between five minutesand one half hour..sh 3 "Read timeouts".ppIt is possible to time out when reading the standard inputor when reading from a remote SMTP server.Technically,this is not acceptable within the published protocols.However,it might be appropriate to set it to something largein certain environments(such as an hour).This will reduce the chance of large numbers of idle daemonspiling up on your system.This timeout is set using the.b roption in the configuration file..sh 3 "Message timeouts".ppAfter sitting in the queue for a few days,a message will time out.This is to insure that at least the sender is awareof the inability to send a message.The timeout is typically set to three days.This timeout is set using the.b Toption in the configuration file..ppThe time of submission is set in the queue,rather than the amount of time left until timeout.As a result, you can flush messages that have been hangingfor a short periodby running the queuewith a short message timeout.For example,.(b/usr/lib/sendmail \-oT1d \-q.)bwill run the queueand flush anything that is one day old..sh 2 "Delivery Mode".ppThere are a number of delivery modes that
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?