[转] Linux 中/var/spool/postfix/maildrop目录下堆积大量小文件
2016-07-21 17:26
567 查看
原文链接:http://blog.chinaunix.net/uid-26364035-id-3163574.html
1,原理分析:
通过调查,是由于linux在执行cron时,会将cron执行脚本中的output和warning信息,都会以邮件的形式发送Cron所有者, 而由于客户环境中的sendmail和postfix没有正常运行,导致邮件发送不成功,全部小文件堆积在了maildrop目录下面,而且没有自动清理转换的机制,所以长达一年的时间,此目录已堆积了大量的文件。查看man cron的信息,可以知道会发送给cron owner.
[root@mw1 postfix]# man cron
DESCRIPTION
Cron searches /var/spool/cron for crontab files which are named after accounts in crontabs found are loaded into memory. Cron also searches for /etc/crontab and the
files in the directory, which are in a different format (see crontab(5) ). Cron then wakes up every minute, examining all stored crontabs, checking each command to see
if it should be run in the current minute. When executing commands, any output is mailed to the owner of the crontab (or to the user named in the MAILTO environment
variable in the crontab, if such exists).
(注意:如果sendmail或者postfix正常运行,则会在/var/mail目录下产生大量的邮件,也会堆积)
2, 解决方案:
在cron的第一行加入 MAILTO=”“便可,这样执行当前用户的Cron时,不会发送邮件。
Please add the MAILTO=”” in the head of cron , please see the blow sample.
[root@mw1 postfix]# crontab -e
MAILTO=””
/5 * * * /opt/OCMonitor/bin//ocSysMonitor -top -sar –netfmt
1,原理分析:
通过调查,是由于linux在执行cron时,会将cron执行脚本中的output和warning信息,都会以邮件的形式发送Cron所有者, 而由于客户环境中的sendmail和postfix没有正常运行,导致邮件发送不成功,全部小文件堆积在了maildrop目录下面,而且没有自动清理转换的机制,所以长达一年的时间,此目录已堆积了大量的文件。查看man cron的信息,可以知道会发送给cron owner.
[root@mw1 postfix]# man cron
DESCRIPTION
Cron searches /var/spool/cron for crontab files which are named after accounts in crontabs found are loaded into memory. Cron also searches for /etc/crontab and the
files in the directory, which are in a different format (see crontab(5) ). Cron then wakes up every minute, examining all stored crontabs, checking each command to see
if it should be run in the current minute. When executing commands, any output is mailed to the owner of the crontab (or to the user named in the MAILTO environment
variable in the crontab, if such exists).
(注意:如果sendmail或者postfix正常运行,则会在/var/mail目录下产生大量的邮件,也会堆积)
2, 解决方案:
在cron的第一行加入 MAILTO=”“便可,这样执行当前用户的Cron时,不会发送邮件。
Please add the MAILTO=”” in the head of cron , please see the blow sample.
[root@mw1 postfix]# crontab -e
MAILTO=””
/5 * * * /opt/OCMonitor/bin//ocSysMonitor -top -sar –netfmt
相关文章推荐
- Linux socket 初步
- Linux Kernel 4.0 RC5 发布!
- linux lsof详解
- linux 文件权限
- Linux 执行数学运算
- 10 篇对初学者和专家都有用的 Linux 命令教程
- Linux 与 Windows 对UNICODE 的处理方式
- Ubuntu12.04下QQ完美走起啊!走起啊!有木有啊!
- 解決Linux下Android开发真机调试设备不被识别问题
- 运维入门
- 运维提升
- Linux 自检和 SystemTap
- Ubuntu Linux使用体验
- c语言实现hashmap(转载)
- Linux 信号signal处理机制
- linux下mysql添加用户
- Scientific Linux 5.5 图形安装教程
- Linux 下无损图片压缩小工具介绍