FreeBSD `freebsd-update` 自动化?

Eon*_*nil 8 automation freebsd

freebsd-update命令在下载后打印更新条目。但它用more. 所以我必须按一些空格才能继续。有没有办法避免这种行为?我想以全自动方式执行更新。

Chr*_*s S 11

在执行任何这些操作之前,请确保您熟悉 freebsd-update 过程、可能的后果和要求。像任何自动更新一样,它有可能会搞砸。

/usr/local/etc/periodic/weekly/912.freebsd-update使用以下内容创建文件:

#!/bin/sh -
#
#

# If there is a global system configuration file, suck it in.
#
if [ -r /etc/defaults/periodic.conf ]
then
    . /etc/defaults/periodic.conf
    source_periodic_confs
fi

case "$weekly_freebsd-update_enable" in
    [Yy][Ee][Ss])
        echo ""
        echo "Updating system via freebsd-update:"

        freebsd-update cron install;;

    *)  rc=0;;
esac

exit $rc
Run Code Online (Sandbox Code Playgroud)

不要忘记chmod +x 912.freebsd-update
通过添加weekly_freebsd-update_enable="YES"/etc/periodic.conf
您的正常定期报告中来启用它,您的正常定期报告将包含操作的日志结果(默认情况下通过电子邮件发送给 root)。

数字 912 是任意的,这只是我使用的数字。你可以选择 900 范围内的任何东西,它应该可以正常工作。