背景:Zabbix报警进程数太多报警Too many processes on servername ...。发现是Sendmail进程数太多。
ps -ef|grep sendmail|wc -l
569
-bash: /data/logs/.syshistory/bash_history.log: Read-only file system
/usr/sbin/postdrop -r
/usr/sbin/sendmail -FCronDaemon -i -odi -oem -oi -t -f root
[aio/21]
[kblockd/18]
[kondemand/0]
[kondemand/1]
[kondemand/N]
执行top的时候发现当前用户下面有很多sendmail的进程,如下图所示,发件人是crondaemon,怀疑是和定时任务有关,查看当前用户的定时任务发现有一个每分钟运行一次的定时任务,但是定时脚本是没有调用sendmail了,ps -ef | grep sendmail | wc -l 统计发现sendmail的进程数据基本上就是从服务器出故障到当前时间的分钟数。
然道是crontab每次执行都会调用sendmail发邮件吗?man 5 crontab查看帮助手册的时候发现这个一段话:
In addition to LOGNAME, HOME, and SHELL, cron(8) will look at MAILTO if it has any reason to send mail as a result of running commands in "this" crontab. If MAILTO is defined (and non-empty), mail is sent to the user so named. If MAILTO is defined but empty (MAILTO=""), no mail will be sent. Otherwise mail is sent to the owner of the crontab. This option is useful if you decide on /bin/mail instead of /usr/lib/sendmail as your mailer when you install cron -- /bin/mail doesnt do aliasing, and UUCP usually doesnt read its mail. If MAILFROM is defined (and non-empty), it will be used as the envelope sender address, otherwise, ‘‘root’’ will be used.
查看crontab的配置文件:
cat /etc/crontab
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
HOME=/
可以看到MAILTO这一行不为空,如果不想让它发邮件的话可以按照手册上面说的把MAILTO这一行删掉或者改为MAILTO=""
From:http://blog.51cto.com/chenql/1878182
ps -ef|grep sendmail|wc -l
569
-bash: /data/logs/.syshistory/bash_history.log: Read-only file system
/usr/sbin/postdrop -r
/usr/sbin/sendmail -FCronDaemon -i -odi -oem -oi -t -f root
[aio/21]
[kblockd/18]
[kondemand/0]
[kondemand/1]
[kondemand/N]
执行top的时候发现当前用户下面有很多sendmail的进程,如下图所示,发件人是crondaemon,怀疑是和定时任务有关,查看当前用户的定时任务发现有一个每分钟运行一次的定时任务,但是定时脚本是没有调用sendmail了,ps -ef | grep sendmail | wc -l 统计发现sendmail的进程数据基本上就是从服务器出故障到当前时间的分钟数。
然道是crontab每次执行都会调用sendmail发邮件吗?man 5 crontab查看帮助手册的时候发现这个一段话:
In addition to LOGNAME, HOME, and SHELL, cron(8) will look at MAILTO if it has any reason to send mail as a result of running commands in "this" crontab. If MAILTO is defined (and non-empty), mail is sent to the user so named. If MAILTO is defined but empty (MAILTO=""), no mail will be sent. Otherwise mail is sent to the owner of the crontab. This option is useful if you decide on /bin/mail instead of /usr/lib/sendmail as your mailer when you install cron -- /bin/mail doesnt do aliasing, and UUCP usually doesnt read its mail. If MAILFROM is defined (and non-empty), it will be used as the envelope sender address, otherwise, ‘‘root’’ will be used.
查看crontab的配置文件:
cat /etc/crontab
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
HOME=/
可以看到MAILTO这一行不为空,如果不想让它发邮件的话可以按照手册上面说的把MAILTO这一行删掉或者改为MAILTO=""
From:http://blog.51cto.com/chenql/1878182
作者:jackxiang@向东博客 专注WEB应用 构架之美 --- 构架之美,在于尽态极妍 | 应用之美,在于药到病除
地址:https://jackxiang.com/post/9585/
版权所有。转载时必须以链接形式注明作者和原始出处及本声明!
最后编辑: jackxiang 编辑于2019-5-20 09:53
评论列表