为什么只下载 apt-get cron 作业
我正在放置一个 crontab 作业,每天使用 apt-get 更新一次(运行 Debian Lenny,几乎每天都有更新)。 但我见过的这个 cron 作业的几乎所有示例都会调用 -d 标志。
这引出了 4 个问题:
- 为什么我应该只下载 包而不安装它们?
- 这岂不是违背了目的 自动运行?
- 难道我不必进去吗? 稍后安装更新?
- 运行 cron 对我来说安全吗 没有 -d 标志的工作?
I'm putting a crontab job for updating with apt-get once a day (running Debian Lenny, there are updates almost daily). But almost all examples i've seen of this cron job invoke the -d flag.
This elicits 4 questions:
- Why should I only download the
packages and not install them? - Doesn't this defeat the purpose of
running it automatically? - Don't I have to go in and actually
install the updates later? - Is it safe for me to run the cron
job without the -d flag?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您的操作是基于一个错误的假设——apt-get(也不是 aptitude)都不是自动运行的,Debian 打包系统也不是真正为其设计的。 这就是为什么这些工具使它变得困难。
如果由于忘记更新配置文件而导致软件升级中断,会发生什么情况? 这种情况过去发生在我身上(apache2),有些造成严重后果,导致机器无法启动(mdadm)。 当软件引入您不想要的依赖项时会发生什么(即引入服务器上的整个 X11 窗口系统)? 等等...
如果您担心自动安装安全升级,您需要查看 无人值守升级包。 它将为您从安全存档中下载并安装软件包。
You're operating on a faulty assumption--neither apt-get (nor aptitude) are meant to be run automatically, nor is the Debian packaging system really designed for it. That's why the tools make it difficult.
What happens when a software upgrade breaks because you forgot to update a configuration file? This has happened to me in the past (apache2), and some with severe consequences that prevented the machine from booting (mdadm). What happens when the software brings in dependencies you don't want (i.e. bringing in the entire X11 windowing system, on a server)? Etc, etc...
If you're worried about installing security upgrades automatically, you want to look at the unattended-upgrades package. It will download and install packages from the security archive for you.
我运行 Ubuntu 服务器,并每周以 root 身份运行一次以下命令。
'-s' 选项告诉 apt-get “模拟”更新软件包,但不实际执行任何操作。
最终效果是我收到一封电子邮件(通过 cron)告诉我有哪些新软件包可用。
然后我可以登录并手动运行它,事先采取必要的预防措施(备份等)。
希望这可以帮助。
I run a Ubuntu server and have the following run as root once a week.
The '-s' option tells apt-get to "simulate" updating the packages but not to actually do anything.
The net effect is I get an email (via cron) telling me what new packages are available.
I can then log in and run it by hand, taking the necessary precautions (backups etc) beforehand.
Hope this helps.