免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2446 | 回复: 0
打印 上一主题 下一主题

[新手入门] /var/spool/mqueue目录是用来干什么的·· [复制链接]

论坛徽章:
1
荣誉会员
日期:2011-11-23 16:44:17
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2006-04-25 23:29 |只看该作者 |倒序浏览
从mqueue 应该可以看出是队列之类的···
邮件队列  摘自系统管理指南
The mail queue is a directory that stores data and controls files for mail messages that the sendmail command delivers. By default, the mail queue is /var/spool/mqueue.
Mail messages might be queued for many reasons.
For example:
  • The sendmail command can be configured to process the queue at certain intervals, rather than immediately. If this is so, mail messages must be stored temporarily.
  • If a remote host does not answer a request for a mail connection, the mail system queues the message and tries again later.
    Printing the Mail Queue
    The contents of the queue can be printed using the mailq command (or by specifying the -bp flag with the sendmail command).
    These commands produce a listing of the queue IDs, the sizes of the messages, the dates the messages entered the queue, and the senders and recipients.
    Mail Queue Files
    Each message in the queue has a number of files associated with it. The files are named according to the following conventions:
    TypefID
    where ID is a unique message queue ID, and Type is one of the following letters indicating the type of file:
    d
    The data file containing the message body without the heading information.
    q
    The queue-control file. This file contains the information necessary to process the job.
    t
    A temporary file. This file is an image of the q file when it is being rebuilt. It is quickly renamed to the q file.
    x
    A transcript file that exists during the life of a session and shows everything that happens during that session.
    For example, if a message has a queue ID of AA00269, the following files are created and deleted in the mail queue directory while the sendmail command tries to deliver the message:
    dfAA00269
    Data file
    qfAA00269
    Control file
    tfAA00269
    Temporary file
    xfAA00269
    Transcript file
    q Control File
    The q control file contains a series of lines, each beginning with a code letter:
    B
    Specifies the body type. The remainder of the line is a text string defining the body type. If this entire field is missing, the body type is 7-bit by default, and no special processing is attempted. Legal values are 7BIT and 8BITMIME.
    C
    Contains the controlling user. For recipient addresses that are a file or a program, sendmail performs delivery as the owner of the file or program. The controlling user is set to the owner of the file or program. Recipient addresses that are read from a .forward or :include: file will also have the controlling user set to the owner of the file. When sendmail delivers mail to these recipients, it delivers as the controlling user, then converts back to root.
    F
    Contains envelope flags. The flags are any combination of w, which sets the EF_WARNING flag; r, which sets the EF_RESPONSE flag; 8, which sets the EF_HAS8BIT flag; and b, which sets the EF_DELETE_BCC flag. Other letters are silently ignored.
    H
    Contains a heading definition. There can be any number of these lines. The order in which the H lines appear determines their order in the final message. These lines use the same syntax as heading definitions in the /etc/mail/sendmail.cf configuration file. (For versions earlier than AIX 5.1, this file is /etc/sendmail.cf.)
    I
    Specifies the inode and device information for the df file; this can be used to recover your mail queue after a disk crash.
    K
    Specifies the time (as seconds) of the last delivery attempt.
    M
    When a message is put into the queue because an error occurred during a delivery attempt, the nature of the error is stored in the M line.
    N
    Specifies the total number of delivery attempts.
    O
    Specifies the original message transfer system (MTS) value from the ESMTP. It is used for Delivery Status Notifications only.
    P
    Contains the priority of the current message. The priority is used to order the queue. Higher numbers mean lower priorities. The priority increases as the message sits in the queue. The initial priority depends on the message class and the size of the message.
    Q
    Contains the original recipient as specified by the ORCPT= field in an ESMTP transaction. Used exclusively for Delivery Status Notifications. It applies only to the immediately following R line.
    R
    Contains a recipient address. There is one line for each recipient.
    S
    Contains the sender address. There is only one of these lines.
    T
    Contains the message creation time used to compute when to time out the message.
    V
    Specifies the version number of the queue file format used to allow new sendmail binaries to read queue files created by older versions. Defaults to version zero. Must be the first line of the file, if present.
    Z
    Specifies the original envelope ID (from the ESMTP transaction). Used for Delivery Status Notifications only.
    $
    Contains a macro definition. The values of certain macros ($r and $s) are passed through to the queue run phase.
    The q file for a message sent to amy@zeus would look similar to:
    P217031
    T566755281
    MDeferred: Connection timed out during user open with zeus
    Sgeo
    Ramy@zeus
    H?P?return-path:  
    Hreceived: by george (0.13 (NL support)/0.01)
            id AA00269; Thu, 17 Dec 87 10:01:21 CST
    H?D?date: Thu, 17 Dec 87 10:01:21 CST
    H?F?From: geo
    Hmessage-id:  
    HTo: amy@zeus
    Hsubject: test
    Where:
    P217031
    Priority of the message
    T566755281
    Submission time in seconds
    MDeferred: Connection timed out during user open with zeus
    Status message
    Sgeo
    ID of the sender
    Ramy@zeus
    ID of the receiver
    H lines
    Header information for the message
    Specifying Time Values in sendmail
    To set the message time-out and queue processing interval, you must use a specific format for the time value. The format of a time value is:
    -qNumberUnit
    where Number is an integer value and Unit is the unit letter. Unit can have one of the following values:
    s
    Seconds
    m
    Minutes
    h
    Hours
    d
    Days
    w
    Weeks
    If Unit is not specified, the sendmail daemon uses minutes (m) as the default. Here are three examples illustrating time-value specification:
    /usr/sbin/sendmail -q15d
    This command tells the sendmail daemon to process the queue every 15 days.
    /usr/sbin/sendmail -q15h
    This command tells the sendmail daemon to process the queue every 15 hours.
    /usr/sbin/sendmail -q15
    This command tells the sendmail daemon to process the queue every 15 minutes.
    Forcing the Mail Queue
    In some cases, you might find that the queue is clogged for some reason. You can force a queue to run using the -q flag (with no value). You can also use the -v flag (verbose) to watch what happens:
    /usr/sbin/sendmail -q -v
    You can also limit the jobs to those with a particular queue identifier, sender, or recipient using one of the queue modifiers. For example, -qRsally restricts the queue run to jobs that have the string sally in one of the recipient addresses. Similarly, -qSstring limits the run to particular senders, and -qIstring limits it to particular queue identifiers.
    Setting the Queue Processing Interval
    The value of the -q flag when the daemon starts determines the interval at which the sendmail daemon processes the mail queue.
    The sendmail daemon is usually started by the /etc/rc.tcpip file, at system startup. The /etc/rc.tcpip file contains a variable called the queue processing interval (QPI), which it uses to specify the value of the -q flag when it starts the sendmail daemon. By default, the value of qpi is 30 minutes. To specify a different queue processing interval:
  • Edit the /etc/rc.tcpip file with your favorite editor.
  • Find the line that assigns a value to the qpi variable, such as:
    qpi=30m
  • Change the value assigned to the qpi variable to the time value you prefer.
    These changes will take effect at the next system restart. If you want the changes to take effect immediately, stop and restart the sendmail daemon, specifying the new -q flag value. See
    Stopping the sendmail Daemon
    and
    Starting the sendmail Daemon
    for more information.
    Moving the Mail Queue
    When a host goes down for an extended period, many messages routed to (or through) that host might be stored in your mail queue. As a result, the sendmail command spends a long time sorting the queue, severely degrading your system performance. If you move the queue to a temporary place and create a new queue, the old queue can be run later when the host returns to service. To move the queue to a temporary place and create a new queue:
  • Stop the sendmail daemon by following the instructions in
    Stopping the sendmail Daemon
    .
  • Move the entire queue directory by entering:
    cd /var/spool
    mv mqueue omqueue
  • Restart the sendmail daemon by following the instructions in
    Starting the sendmail Daemon
    .
  • Process the old mail queue by entering:
    /usr/sbin/sendmail -oQ/var/spool/omqueue -q
    The -oQ flag specifies an alternate queue directory. The -q flag specifies to run every job in the queue. To get a report about the progress of the operation, use the -v flag.
    Note:
    This operation can take some time.
  • Remove the log files and the temporary directory when the queue is empty by entering:
    rm /var/spool/omqueue/*
    rmdir /var/spool/omqueue
    Starting the sendmail Daemon
    To start the sendmail daemon, enter either of the following commands:
    startsrc -s sendmail -a "-bd -q15"
    /usr/lib/sendmail -bd -q15
    If the sendmail daemon is already active when you enter one of these commands, you see the following message on the screen:
    The sendmail subsystem is already active. Multiple instances are not supported.
    If the sendmail daemon is not already active, then you see a message indicating that the sendmail daemon has been started.
    Stopping the sendmail Daemon
    To stop the sendmail daemon, run the stopsrc -s sendmail command.
    If the sendmail daemon was not started with the startsrc command:

    • Find the sendmail process ID.
    • Enter the kill sendmail_pid command (where sendmail_pid is the process ID of the sendmail process).



    本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/16252/showart_104847.html
  • 您需要登录后才可以回帖 登录 | 注册

    本版积分规则 发表回复

      

    北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
    未成年举报专区
    中国互联网协会会员  联系我们:huangweiwei@itpub.net
    感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

    清除 Cookies - ChinaUnix - Archiver - WAP - TOP