RANDOM_DELAY 不适用于 Amazon Linux 2

问题描述

在 Amazon Linux 2 上,RANDOM_DELAY 不会应用于默认作业 ( /etc/cron.d/update-motd )。

所有与 motd(今日消息)相关的脚本在实例启动时提供,我没有更改任何脚本。尽管如此,update-motd 每天都在同一时间运行。你能告诉我原因吗?

每天 03:26,此命令将在 /etc/update-motd.d/70-available-updates 中执行。

-------- start Fri Jan 29 03:26:04 UTC 2021
USER       PID   LWP %CPU NLWP %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root      0000  0000 23.5    1 13.4 362776 65956 ?        R    03:26   0:00 /usr/bin/python /usr/bin/yum --debuglevel 2 --security check-update

操作系统版本:

uname -a

Linux ip-000-000-000-000.ap-northeast-1.compute.internal 4.14.177-139.253.amzn2.x86_64 #1 SMP Wed Apr 29 09:56:20 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

update-motd 的内容:

cat /etc/cron.d/update-motd

# Delay a random time between 0 and 360 minutes (6 hours) to avoid having all
# instances update at the same time.
RANDOM_DELAY=360
@daily root /usr/bin/systemctl --quiet restart update-motd
cat /etc/update-motd.d/70-available-updates

#!/bin/bash

# Possible summaries include:
# No packages needed for security; %d packages available
# %d package(s) needed[ (+%d related)] for security,out of %d available
# There are [[%d security update(s)[ out of ]%d total update(s)]] available
LANG=C timeout 30s /usr/bin/yum \
    --debuglevel 2 \
    --security check-update 2>/dev/null \
        | grep -P '(?<! 0 packages) available$' \
    && echo 'Run "sudo yum update" to apply all updates.'

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)