Ubuntu /var/spool/mqueue-client
目录下会有大量文件, 产生的原因是: cron
任务中有输出内容时,默认会通过sendmail 发送,但是如果服务器上没有 sendmail 服务时,会将发送内容保存到这个目录内。
1、处理方式: 修改 /etc/crontab
内的任务,将输入内容抛弃
# 在每个任务后面加上下面命令
> /dev/null >&2
解释: 1、
>
重定向的意思,表示将输出的内容写入到/dev/null
中,但是/dev
目录下并没有null
这个文件,所以这个意思就是把内容抛弃掉。
2、>&2
实际是1>&2
的简写。 1: 表示标准输出; 2: 表示错误输出;
3、>&2
的意思是: 1 的输出处理方式 跟 2 一致。
2、 /etc/crontab
修改示例
17 * * * * root cd / && run-parts --report /etc/cron.hourly >/dev/null 2>&1
25 6 * * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily ) >/dev/null 2>&1
47 6 * * 7 root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly ) >/dev/null 2>&1
52 6 1 * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly ) >/dev/null 2>&1
网友评论