我有一台只运行 mysql+php 的服务器。Cronned PHP 脚本(不公开提供)偶尔会发送电子邮件,但每小时不超过 10 封。但是,每当我在 bash 中输入“top”时,我都会看到类似以下内容:
top - 00:44:33 up 13 days, 18:47, 1 user, load average: 31.43, 31.17, 30.75
Tasks: 196 total, 1 running, 195 sleeping, 0 stopped, 0 zombie
%Cpu(s): 1.0 us, 1.2 sy, 0.0 ni, 66.3 id, 31.4 wa, 0.1 hi, 0.0 si, 0.0 st
KiB Mem: 32857820 total, 28981048 used, 3876772 free, 190144 buffers
KiB Swap: 16768892 total, 343284 used, 16425608 free. 22893448 cached Mem
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
29004 www-data 20 0 388240 15636 5352 S 2.7 0.0 0:00.83 apache2
1260 mysql 20 0 9719528 3.998g 4904 S 2.3 12.8 1358:52 mysqld
1414 root 20 0 106952 8688 1668 D 0.7 0.0 0:28.56 sendmail-mta
1675 syslog 20 0 260848 32684 960 S 0.7 0.1 187:49.06 rsyslogd
11894 root 20 0 108408 10172 1668 D 0.7 0.0 1:05.93 sendmail-mta
13597 root 20 0 106160 7916 1668 D 0.7 0.0 0:10.16 sendmail-mta
19896 root 20 0 108140 9864 1668 D 0.7 0.0 0:57.19 sendmail-mta
30286 root 20 0 105896 7680 1668 D 0.7 0.0 0:04.58 sendmail-mta
8 root 20 0 0 0 0 S 0.3 0.0 25:54.50 rcuos/0
9 root 20 0 0 0 0 S 0.3 0.0 30:23.56 rcuos/1
10 root 20 0 0 0 0 S 0.3 0.0 30:10.26 rcuos/2
11 root 20 0 0 0 0 S 0.3 0.0 35:55.97 rcuos/3
14 root 20 0 0 0 0 S 0.3 0.0 28:06.34 rcuos/6
264 root 20 0 0 0 0 D 0.3 0.0 94:44.98 jbd2/md2-8
721 root 20 0 108008 9784 1668 D 0.3 0.0 0:56.14 sendmail-mta
1029 root 20 0 107084 8812 1668 D 0.3 0.0 0:31.64 sendmail-mta
1493 root 20 0 108932 10684 1668 D 0.3 0.0 1:18.55 sendmail-mta
2991 root 20 0 105764 7580 1668 D 0.3 0.0 0:02.18 sendmail-mta
9322 root 20 0 107480 9184 1668 D 0.3 0.0 0:40.74 sendmail-mta
11139 root 0 -20 0 0 0 S 0.3 0.0 0:05.35 kworker/u17:2
11767 root 20 0 24964 1744 1176 R 0.3 0.0 0:00.56 top
12332 root 20 0 107084 8904 1668 D 0.3 0.0 0:33.95 sendmail-mta
15232 root 20 0 107616 9312 1668 D 0.3 0.0 0:44.07 sendmail-mta
16204 root 20 0 108800 10460 1668 D 0.3 0.0 1:13.26 sendmail-mta
17133 root 20 0 107216 9016 1668 D 0.3 0.0 0:36.18 sendmail-mta
18282 root 20 0 106560 8396 1668 D 0.3 0.0 0:21.29 sendmail-mta
18284 root 20 0 106688 8500 1668 D 0.3 0.0 0:24.23 sendmail-mta
18834 root 20 0 106560 8284 1668 D 0.3 0.0 0:18.80 sendmail-mta
21074 root 20 0 107876 9644 1668 D 0.3 0.0 0:51.99 sendmail-mta
21632 root 20 0 106028 7784 1668 D 0.3 0.0 0:07.25 sendmail-mta
21874 root 20 0 109064 10864 1668 D 0.3 0.0 1:22.93 sendmail-mta
26762 root 20 0 107348 9116 1668 D 0.3 0.0 0:39.16 sendmail-mta
30181 root 20 0 108272 10028 1668 D 0.3 0.0 1:02.36 sendmail-mta
1 root 20 0 34224 2036 1296 S 0.0 0.0 0:06.01 init
2 root 20 0 0 0 0 S 0.0 0.0 0:00.24 kthreadd
3 root 20 0 0 0 0 S 0.0 0.0 1:12.29 ksoftirqd/0
5 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kworker/0:0H
7 root 20 0 0 0 0 S 0.0 0.0 26:11.06 rcu_sched
12 root 20 0 0 0 0 S 0.0 0.0 25:56.72 rcuos/4
13 root 20 0 0 0 0 S 0.0 0.0 29:28.44 rcuos/5
15 root 20 0 0 0 0 S 0.0 0.0 27:28.79 rcuos/7
如何摆脱这些发送邮件?该服务器是否变成了垃圾邮件服务器?
我刚刚检查了 /var/log/mail.log 上的 8 GB 邮件日志文件(mail.err 为 2 GB,包含与下面类似的消息)。似乎每一秒我都会收到数百条错误消息:
c /usr/sbin/sensible-mda: No such file or directory
Oct 23 01:13:52 Ubuntu-1204-precise-64-minimal sm-mta[10416]: s9MEL4VU004904: to=<root@Ubuntu-1204-precise-64-minimal>, delay=08:52:47, xdelay=00:00:00, mailer=local, pri=4622861, dsn=4.0.0, stat=Operating system error
Oct 23 01:13:52 Ubuntu-1204-precise-64-minimal sm-mta[18516]: s9JCvGxc029924: Warning: program /usr/sbin/sensible-mda unsafe: No such file or directory
Oct 23 01:13:52 Ubuntu-1204-precise-64-minimal sm-mta[18516]: s9JCvGxc029924: SYSERR(root): Cannot exec /usr/sbin/sensible-mda: No such file or directory
Oct 23 01:13:52 Ubuntu-1204-precise-64-minimal sm-mta[15232]: s9JCvGxc029924: to=root, delay=3+04:03:05, xdelay=00:00:00, mailer=local, pri=35400000, dsn=4.0.0, stat=Operating system error
Oct 23 01:13:52 Ubuntu-1204-precise-64-minimal sm-mta[18517]: s9INvGkB009352: Warning: program /usr/sbin/sensible-mda unsafe: No such file or directory
Oct 23 01:13:52 Ubuntu-1204-precise-64-minimal sm-mta[18518]: s9J2lGxv018288: Warning: program /usr/sbin/sensible-mda unsafe: No such file or directory
Oct 23 01:13:52 Ubuntu-1204-precise-64-minimal sm-mta[18517]: s9INvGkB009352: SYSERR(root): Cannot exec /usr/sbin/sensible-mda: No such file or directory
Oct 23 01:13:52 Ubuntu-1204-precise-64-minimal sm-mta[18518]: s9J2lGxv018288: SYSERR(root): Cannot exec /usr/sbin/sensible-mda: No such file or directory
Oct 23 01:13:52 Ubuntu-1204-precise-64-minimal sm-mta[18519]: s9M3HG5V029554: Warning: program /usr/sbin/sensible-mda unsafe: No such file or directory
Oct 23 01:13:52 Ubuntu-1204-precise-64-minimal sm-mta[18519]: s9M3HG5V029554: SYSERR(root): Cannot exec /usr/sbin/sensible-mda: No such file or directory
Oct 23 01:13:52 Ubuntu-1204-precise-64-minimal sm-mta[18520]: s9LJHGAs025335: Warning: program /usr/sbin/sensible-mda unsafe: No such file or directory
Oct 23 01:13:52 Ubuntu-1204-precise-64-minimal sm-mta[721]: s9INvGkB009352: to=root, delay=3+16:07:48, xdelay=00:00:00, mailer=local, pri=40620000, dsn=4.0.0, stat=Operating system error
Oct 23 01:13:52 Ubuntu-1204-precise-64-minimal sm-mta[18520]: s9LJHGAs025335: SYSERR(root): Cannot exec /usr/sbin/sensible-mda: No such file or directory
Oct 23 01:13:52 Ubuntu-1204-precise-64-minimal sm-mta[21074]: s9J2lGxv018288: to=root, delay=3+14:39:10, xdelay=00:00:00, mailer=local, pri=40170000, dsn=4.0.0, stat=Operating system error
Oct 23 01:13:52 Ubuntu-1204-precise-64-minimal sm-mta[18521]: s9MId1GO014969: Warning: program /usr/sbin/sensible-mda unsafe: No such file or directory
Oct 23 01:13:52 Ubuntu-1204-precise-64-minimal sm-mta[2991]: s9M3HG5V029554: to=root, delay=11:59:38, xdelay=00:00:00, mailer=local, pri=6060000, dsn=4.0.0, stat=Operating system error
Oct 23 01:13:52 Ubuntu-1204-precise-64-minimal sm-mta[21632]: s9LJHGAs025335: to=root, delay=19:45:57, xdelay=00:00:00, mailer=local, pri=9750000, dsn=4.0.0, stat=Operating system error
Oct 23 01:13:52 Ubuntu-1204-precise-64-minimal sm-mta[18521]: s9MId1GO014969: SYSERR(root): Cannot exec /usr/sbin/sensible-mda: No such file or directory
Oct 23 01:13:52 Ubuntu-1204-precise-64-minimal sm-mta[18524]: s9I6vGQY014865: Warning: program /usr/s
我该怎么办?我是新手,请给我一些提示。
编辑:解决 sensible-mda 问题后,mail.log 仍然不断增长,现在如下所示:
Oct 23 02:57:55 Ubuntu-1204-precise-64-minimal sm-mta[18356]: s9LIHGb5020340: to=root, delay=22:29:33, xdelay=00:00:00, mailer=local, pri=10560000, dsn=2.0.0, stat=Sent
Oct 23 02:57:55 Ubuntu-1204-precise-64-minimal sm-mta[22383]: s9M57GIm010249: to=root, delay=11:20:38, xdelay=00:00:00, mailer=local, pri=5430000, dsn=2.0.0, stat=Sent
Oct 23 02:57:55 Ubuntu-1204-precise-64-minimal sm-mta[18356]: s9LIHGac020340: to=root, delay=22:30:08, xdelay=00:00:00, mailer=local, pri=10560000, dsn=2.0.0, stat=Sent
Oct 23 02:57:56 Ubuntu-1204-precise-64-minimal sm-mta[22383]: s9M5HGR4024737: to=root, delay=11:11:19, xdelay=00:00:01, mailer=local, pri=5430000, dsn=2.0.0, stat=Sent
Oct 23 02:57:56 Ubuntu-1204-precise-64-minimal sm-mta[18356]: s9LIHGc9020340: to=root, delay=22:27:59, xdelay=00:00:00, mailer=local, pri=10560000, dsn=2.0.0, stat=Sent
Oct 23 02:57:56 Ubuntu-1204-precise-64-minimal sm-mta[22383]: s9M5HGQQ024737: to=root, delay=11:12:30, xdelay=00:00:00, mailer=local, pri=5430000, dsn=2.0.0, stat=Sent
Oct 23 02:57:56 Ubuntu-1204-precise-64-minimal sm-mta[18356]: s9LIHGbr020340: to=root, delay=22:28:25, xdelay=00:00:00, mailer=local, pri=10560000, dsn=2.0.0, stat=Sent
Oct 23 02:57:57 Ubuntu-1204-precise-64-minimal sm-mta[4623]: s9M9v2BT016169: timeout waiting for input from local during Draining Input
Oct 23 02:57:57 Ubuntu-1204-precise-64-minimal sm-mta[22383]: s9M5HGQj024737: to=root, delay=11:11:55, xdelay=00:00:01, mailer=local, pri=5430000, dsn=2.0.0, stat=Sent
Oct 23 02:57:58 Ubuntu-1204-precise-64-minimal sm-mta[18356]: s9LIHGae020340: to=root, delay=22:30:09, xdelay=00:00:01, mailer=local, pri=10560000, dsn=2.0.0, stat=Sent
答案1
也许是由于之前的配置错误,您的服务器进入了这个通过电子邮件通知电子邮件错误的漩涡循环。
“嗯,看来我无法发送我的电子邮件...嘿,我有一个主意,我会在电子邮件中报告!哦,我想我关于这个错误的报告没有通过,让我通过电子邮件报告这个错误...”。
确保所有配置都正确,然后查看是否存在实际的要传送的电子邮件。