通常,Amazon 上的 Ubuntu AMI 每天的 cron 作业都/etc/cron.daily
安排在早上的时间。此计划使用 管理/etc/crontab
。示例/etc/crontab
如下所示:
$ cat /etc/crontab
# /etc/crontab: system-wide crontab
# Unlike any other crontab you don't have to run the `crontab'
# command to install the new version when you edit this file
# and files in /etc/cron.d. These files also have username fields,
# that none of the other crontabs do.
SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
# m h dom mon dow user command
17 * * * * root cd / && run-parts --report /etc/cron.hourly
25 6 * * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
47 6 * * 7 root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )
52 6 1 * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )
#
显然,每日任务在早上 6:25 运行。如果这会影响服务器的直接交付,您可能需要调整这些设置以将日常任务移至其他时间。此外,您可以调查下的项目/etc/cron.daily
。对我来说,它看起来像:
$ ls /etc/cron.daily/
apport apt aptitude bsdmainutils dpkg logrotate man-db mlocate popularity-contest standard
其中,通常man-db
并且logrotate
可能会占用大量 CPU 时间来执行。这些是标准任务,可以进行调整以获得最佳性能。您可能需要考虑调整您的 logrotate 和 man-db 策略。
希望这可以帮助。