问题

当在Debian或Ubuntu Linux上有可用的升级或安全更新时,如何强制apt-get向我发送电子邮件?

Debian/Ubuntu Linux:在有安全升级时,自动发送电子邮件通知

安装Apticron

在shell提示符下键入以下命令:

# apt-get update
# apt-get install apticron

配置apticron发送电子邮件通知

默认的配置文件位于/etc/apticron/apticron.conf。使用文本编辑器打开文件:

# vi /etc/apticron/apticron.conf

您需要设置电子邮件地址,以通过电子邮件发送通知,如下所示:

EMAIL="jack@onitroad.com"

我的样本配置文件:

# apticron.conf
#
# set EMAIL to a list of addresses which will be notified of impending updates
#
EMAIL="jack@onitroad.com"

#
# Set LISTCHANGES_PROFILE if you would like apticron to invoke apt-listchanges
# with the --profile option. You should add a corresponding profile to
# /etc/apt/listchanges.conf
#
# LISTCHANGES_PROFILE="apticron"

#
# Set SYSTEM if you would like apticron to use something other than the output
# of "hostname -f" for the system name in the mails it generates
#
# SYSTEM="foobar.example.com"

#
# Set IPADDRESSNUM if you would like to configure the maximal number of IP
# addresses apticron displays. The default is to display 1 address of each
# family type (inet, inet6), if available.
#
# IPADDRESSNUM="1"

#
# Set IPADDRESSES to a whitespace seperated list of reachable addresses for
# this system. By default, apticron will try to work these out using the
# "ip" command
#
# IPADDRESSES="192.0.2.1 2001:db8:1:2:3::1"

保存并关闭文件。 /etc/cron.daily/apticron是每天执行apticron的cron脚本。

当Debian/Ubuntu安全团队发布安全更新时,您会收到一封电子邮件。我还建议通过RSS或电子邮件订阅Debian电子邮件安全更新通知和Ubuntu Linux安全通知。

解决方案

可以使用apticron命令/脚本进行通知。

apticron主要用于自动通知未决的安全更新,但也可以用于许多其他需要及时更新的情况。

日期:2019-11-20 08:54:13 来源:oir作者:oir