centos7操作系统定时自动更新

网友投稿 919 2022-11-08

本站部分文章、图片属于网络上可搜索到的公开信息,均用于学习和交流用途,不能代表睿象云的观点、立场或意见。我们接受网民的监督,如发现任何违法内容或侵犯了您的权益,请第一时间联系小编邮箱jiasou666@gmail.com 处理。

centos7操作系统定时自动更新

安装服务

yum -y install yum-cronsystemctl start yum-cron.servicesystemctl enable yum-cron.service

配置文件

每天执行的cron任务的配置文件:

/etc/yum/yum-cron.conf

每小时执行的cron任务的配置文件:

/etc/yum/yum-cron-hourly.conf

可以看到cron的定时任务配置文件:

/etc/cron.daily/0yum-daily.cron/etc/cron.hourly/0yum-hourly.cron

/etc/yum/yum-cron.conf

[commands]# What kind of update to use:# default = yum upgrade# security = yum --security upgrade# security-severity:Critical = yum --sec-severity=Critical upgrade# minimal = yum --bugfix update-minimal# minimal-security = yum --security update-minimal# minimal-security-severity:Critical = --sec-severity=Critical update-minimal# 这里定义是要更新什么内容,默认是更新整个系统update_cmd = default# Whether a message should be emitted when updates are available,# were downloaded, or applied.update_messages = yes# Whether updates should be downloaded when they are available.download_updates = yes# Whether updates should be applied when they are available. Note# that download_updates must also be yes for the update to be applied.# 应用更新apply_updates = yes# Maximum amout of time to randomly sleep, in minutes. The program# will sleep for a random amount of time between 0 and random_sleep# minutes before running. This is useful for e.g. staggering the# times that multiple systems will access update servers. If# random_sleep is 0 or negative, the program will run immediately.# 6*60 = 360random_sleep = 360[emitters]# Name to use for this system in messages that are emitted. If# system_name is None, the hostname will be used.system_name = None# How to send messages. Valid options are stdio and email. If# emit_via includes stdio, messages will be sent to stdout; this is useful# to have cron send the messages. If emit_via includes email, this# program will send email itself according to the configured options.# If emit_via is None or left blank, no messages will be sent.emit_via = stdio# The width, in characters, that messages that are emitted should be# formatted to.output_width = 80[email]# The address to send email messages from.# NOTE: 'localhost' will be replaced with the value of system_name.email_from = root@localhost# List of addresses to send messages to.email_to = root# Name of the host to connect to to send email messages.email_host = localhost[groups]# NOTE: This only works when group_command != objects, which is now the default# List of groups to updategroup_list = None# The types of group packages to installgroup_package_types = mandatory, default[base]# This section overrides yum.conf# Use this to filter Yum core messages# -4: critical# -3: critical+errors# -2: critical+errors+warnings (default)debuglevel = -2# skip_broken = Truemdpolicy = group:main# Uncomment to auto-import new gpg keys (dangerous)# assumeyes = True

总结

这种自动更新还是不要放到生产环境了,毕竟生产系统升级还是需要进行测试的,如果是一些不主要的服务系统,为了防止忘记安全更新,可以添加上这个服务。

上一篇:软件测试培训之针对测试报告进行针对性优化
下一篇:软件测试培训之常用压力测试工具选型
相关文章

 发表评论

暂时没有评论,来抢沙发吧~