linux内存大量占用,大量sendmail、postdrop进程 侵删 您所在的位置:网站首页 侵删是什么 linux内存大量占用,大量sendmail、postdrop进程 侵删

linux内存大量占用,大量sendmail、postdrop进程 侵删

2023-08-26 15:09| 来源: 网络整理| 查看: 265

linux环境32G内存,used 28G,其实并没有什么用户进程,占用也不大

使用echo 1 > /proc/sys/vm/drop_caches、echo 3 > /proc/sys/vm/drop_caches释放内存都没多大效果,说明内存确实分配到进程了使用ps -e -o 'pid,comm,args,pcpu,rsz,vsz,stime,user,uid'查看进程详细信息,发现存在大量sendmail、postdrop进程,虽然单个占用内存不多,但是量太大了killall sendmail & killall postdrop先杀掉进程,内存占用瞬间降低到2G,说明是这个原因查问题原因,解决

 

原文:cnblogs.com/skyaccross/archive/2013/03/21/crond_sendmail.html

今天一位同事说一个服务器common账号登陆不进去,说是资源耗尽,要我帮忙检查一下 我用另一个账号登陆到服务器,首先我想看看common账号到底启动了哪些dd引起资源耗尽

ps -u common

发现有个 sendmail的启动特别多 例如

common 31446 31377 0 20:20 ? /usr/sbin/sendmail -FCronDaemon -i -odi -oem -oi -t -f root

鉴于资源耗尽,留下证据后,先杀掉,保证生产

ps -ef|grep "/usr/sbin/sendmail"|grep -v grep |awk '{print $2}'|xargs kill

然后检查是哪个进程启动了sendmail

ps -ef|grep 31337

发现是crond启动了,当时就奇怪了,这个进程怎么会调用sendmail 既然是crond启动的,而之前一直好好的,于是询问最近谁修改了crond 得知有一位同事添加了 一个crond记录,一分钟运行一次 这时查看sendmail进程 ps -ef|grep sendmail 果然又有了,而且sendmail是1分钟启动一个。果断的怀疑他,将它从crontab暂停,2分钟过去 没有新的sendmail启动,于是将问题就锁定在它身上了。 也没有想到原因,为啥crond会调用sendmail,google之找到了这样一句 crond在执行脚本时会将脚本输出信息以邮件的形式发送给crond用户,而环境的postfix没有正常运行,导致邮件发送失败 查看我们的 maillog,确实有很多错误

postfix/postdrop[23110]: warning: mail_queue_enter: create file maildrop/749274.23110: No such file or directory

解决方法就是 在crontab中第一行增加MAILTO=""发送为空 如果cron有什么原因需要将命令结果发一封邮件,那么就要看MAILTO这部分了,如果给MAILTO赋值了,并且不是空,那么就会发给这个用户; 如果是空,MAILTO="",那就不发任何邮件。 如果没有定义MAILTO,也就是说crontab里面没有写这一行,那么就发给这个crontab的用户 原文如下

复制代码

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 aresult of running commands in "this" crontab. If MAILTO is defined (and non-empty), mail is sent to the userso 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 doesn′t do aliasing, and UUCP usually doesn′t read its mail. If MAIL-FROM is defined (and non-empty), it will be used as the envelope sender address, otherwise, ‘‘root’’ will be used.

复制代码

我们这个不需要发邮件,于是 在crontab 第一行加上 MAILTO="" 观察了两分钟,问题解决。

 

原文:https://blog.csdn.net/liang100k/article/details/53635344

问题:服务器内存接近耗尽报警,ps -ef查看有3000多个进程,大部分都是crond、sendmail、postdrop

而 postdrop是由sendmail启动的,而sendmail又是由crond启动的。

 

问题成因:crond在执行脚本时会将脚本输出信息以邮件的形式发送给系统用户,所以必然要调用sendmail,而sendmail又会调用postdrop发送邮件,但是如果系统的postfix服务没有正常运行,那么邮件就会发送不成功,造成sendmail、postdrop、crond进程就无法正常退出,形成大量的僵尸进程

 

解决办法:先把僵尸进程都干掉ps -ef | egrep "sendmail|postdrop" | grep -v grep |xargs kill,让内存降下来,其实我一开始将postfix服务重启了一下,问题就解决了,观察了一段时间,僵尸进程并没有再次出现。

为防以后postfix挂了再出现类似问题,可以进行如下配置,将crond的邮件通知关闭:

将/etc/crontab和/etc/cron.d/0hourly里的MAILTO=root修改为MAILTO=""

crontab -e第一行增加一段MAILTO=""

 

原文:http://blog.itpub.net/29071259/viewspace-1427129/

原因: crontab 如果有错误,没有重定向,需要输出到屏幕时。就会产生 /usr/sbin/sendmail 产生如下的多个进程: [cron] [backup_db_cront] /usr/sbin/sendmail -FCronDaemon -i -odi -oem -oi -t -f root /usr/sbin/postdrop -r查看邮件日志:  cd /var/spool/postfix/maildrop查看60分钟内的log find . -mmin -60找出错误所在。



【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有