Cron 在失败时发送电子邮件,不知道为什么

Cron 在失败时发送电子邮件,不知道为什么

我的 cron 在发生错误时发送电子邮件,这很好,但它存在两个问题。

  1. 我不记得设置它,所以也不记得它在哪里设置。
  2. 它正在向不存在的电子邮件地址发送邮件。我只看到“发件人”电子邮件地址中的电子邮件为“发送失败”电子邮件。

在我的var/log/mail.log我看到以下内容:

Nov  7 06:25:04 vandenberg postfix/pickup[2527]: B62C3140B94: uid=0 from=<root>
Nov  7 06:25:04 vandenberg postfix/cleanup[8315]: B62C3140B94: message-id=<[email protected]>
Nov  7 06:25:04 vandenberg postfix/qmgr[22166]: B62C3140B94: from=<[email protected]>, size=738, nrcpt=1 (queue active)
Nov  7 06:25:06 vandenberg postfix/smtp[8317]: B62C3140B94: to=<[email protected]>, orig_to=<root>, relay=smtp.gmail.com[blabla]:587, delay=1.8, delays=0.18/0.1/0.46/1.1, dsn=2.0.0, status=sent (250 2.0.0 OK 1478496306 g184sm7156932wme.23 - gsmtp)
Nov  7 06:25:06 vandenberg postfix/qmgr[22166]: B62C3140B94: removed

两个mail.nonexistent.com条目都是相同的地址。

我看到的电子邮件如下:

Delivery to the following recipient failed permanently:

     [email protected]

Technical details of permanent failure:
DNS Error: 159949072 DNS type 'mx' lookup of mail.nonexistent.com responded with code NXDOMAIN
Domain name not found: mail.nonexistent.com


----- Original message -----

DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20120113;
        h=from:to:subject:mime-version:content-transfer-encoding:message-id
         :date;
        bh=4yOG03cMbyTGx1B7oNyAICwDj42G7bYEMTzfRihbet0=;
        b=T6I62wxHoVle9UPqoQOx8WdcVhZXHKQAuj94IuPnoQ1T+pPrLl/6dwQreJhRN7An9r
         i+Uz2iHwCPGalVQsYxlVwl1RDFSGRUnsJlq9dLDiww64Px1h/axXHoWCwOya/OWXbO1C
         eADVVU1FAyJVH3+K47WZXU95+p13rW+eg9fLppRHPI+xpeRSOarHjwF8bYKPD3bPA1qn
         NCeZ6vbK8IaPUBUoGpKJduqZZ8/85aPsq/cHAyXESxllcw25HbgA8HGQmuJRyhwUzvZf
         37kFnylOHqKSF/BkjZBUcNnZrp+jW8QoDr5/8yQjWK3Qrb1uKTHI5gm/rK815g2dyG3R
         vnfg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:from:to:subject:mime-version
         :content-transfer-encoding:message-id:date;
        bh=4yOG03cMbyTGx1B7oNyAICwDj42G7bYEMTzfRihbet0=;
        b=k1iyt+Tx4HhSyhYV/wCvep1vRi+sOk/j8e0B3nFQdwgglBHlnWiRsCpwmU8vVGw0XF
         h9Gggs6s8u68nw+HCzg5tcNH/76UAvGVr7YcT/cEkOzaMOULEiGgUQ/BTI5ghbpRoXX/
         28u6iKzCFlRp/VhbJRQ3mPASoHlw+w53Q1krTyC4as3VSN2rGhdcDG1MjtDdwyjB9PzO
         WW7oY8DuRJIHkKsGTiq+MIMs+ys8/1av0/nM5ZveGsypbMIJXdHr4HlCrkVgDhRHwey5
         X2+ogCqfPub+fpqazlHVLdAWSbVAc9OW88wMsIRloMWFSWCXmoJ3JoJoUKUZiHZZIvrE
         G/Hg==
X-Gm-Message-State: ABUngvf6UR5IHY4bkUC8h2qfQThTw4RCCPw1/fLjwvhZ9ZYFdfWj5UPewkIAcRpAdP7RfA==
X-Received: by 10.28.107.129 with SMTP id a1mr6680384wmi.90.1478496306482;
        Sun, 06 Nov 2016 21:25:06 -0800 (PST)
Return-Path: <[email protected]> // This is how I got this email.
Received: from SERVER.WORKGROUP (d5c5247e.ftth.concepts.nl. [213.197.36.126])
        by smtp.gmail.com with ESMTPSA id g184sm7156932wme.23.2016.11.06.21.25.05
        for <[email protected]>
        (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
        Sun, 06 Nov 2016 21:25:05 -0800 (PST)
From: Cron Daemon <[email protected]>
X-Google-Original-From: [email protected] (Cron Daemon)
Received: by SERVER.WORKGROUP (Postfix, from userid 0)
        id B62C3140B94; Mon,  7 Nov 2016 06:25:04 +0100 (CET)
To: [email protected]
Subject: Cron <root@vandenberg> test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Cron-Env: <SHELL=/bin/sh>
X-Cron-Env: <PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin>
X-Cron-Env: <HOME=/root>
X-Cron-Env: <LOGNAME=root>
Message-Id: <[email protected]>
Date: Mon,  7 Nov 2016 06:25:04 +0100 (CET)

/etc/cron.daily/logrotate:
gzip: stdin: file size changed while zipping

其内容/etc/cron.daily/logrotate为:

#!/bin/sh

test -x /usr/sbin/logrotate || exit 0
/usr/sbin/logrotate /etc/logrotate.conf

这种电子邮件发送行为可以在哪里配置,以及如何获取[email protected]电子邮件地址?

注意,主机名设置为实际存在的地址,但似乎未被使用。

root@vandenberg:/etc/cron.daily# hostname
existent.com
SERVER

答案1

Daniel 和 phillip-zyan k lee-stockmann 的评论为我指明了正确的方向。

使用grep -Ri nonexistent.com /etc/一个文件后弹出,/etc/mailname

看来这个文件定义了 Debian 上所有邮件应用程序的主机名,所以我修改了它。看来这解决了问题。

相关内容