# 5.4 系统更新检测

> **技巧**
>
> FreeBSD 下的 KDE6 自带类似功能，无需安装 `freebsd-update-notify`，本节仅作示例。

freebsd-update-notify 可自动检测 FreeBSD 系统和 pkg 包的更新。

## 安装 freebsd-update-notify

使用 pkg 安装：

```sh
# pkg install freebsd-update-notify
```

或使用 Ports 安装：

```sh
# cd /usr/ports/deskutils/freebsd-update-notify/
# make install clean
```

## 配置 freebsd-update-notify

freebsd-update-notify 的配置文件位于 **/usr/local/etc/freebsd-update-notify/freebsd-update-notify.conf**。

默认配置的更新间隔较长，可以改为：

```ini
max-days-between-updates    1   # 更新检测间隔（日）
hours-between-reminders     8   # 提醒间隔（小时）
```

## 图片示例

> **技巧**
>
> 截图为手动执行示例，实际上程序可以在后台自动运行，无需手动验证。如果无法复现，可以将 `freebsd-update-notify.conf` 中两个值都改为 `0`，再手动以 `root` 权限执行 **/usr/local/libexec/freebsd-update-notify**。

freebsd-update-notify 的日志位于 **/var/log/freebsd-update-cron** 和 **/var/log/freebsd-update-notify**。如果要反馈故障，请使用英文提交至 [issue](https://github.com/outpaddling/freebsd-update-notify/issues)。

![freebsd-update-notify on FreeBSD](/files/JikDcTZjhh2YkPAjyQo5)

![freebsd-update-notify on FreeBSD](/files/zOqdtGDEFOs38D0wPJSU)

![freebsd-update-notify on FreeBSD](/files/CemHfh2wvBHIOcdqJb4t)

## 课后习题

1. 使用更优雅的方式进行系统更新提示。
2. 尝试将更新提示功能合并入 pkg 源代码。
3. 系统更新提示的“推送”模型隐含了维护者对用户系统的干预权。比较 FreeBSD freebsd-update 的主动拉取模型与 Windows Update 的静默推送模型在用户自主性与安全时效性的平衡策略，并分析何种模型更有利于维护用户的知情同意。


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://book.bsdcn.org/di-5-zhang-ruan-jian-guan-li-he-xi-tong-sheng-ji/di-5.4-jie-update.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
