如何在Snappy Ubuntu Core中设置autopilot

在Snappy Ubuntu Core中,autoupilot是它的一个特性.只要autopilot功能是开的情况下,并且我们的Snappy设备是在联网的情况下,它就可以自动联网并进行更新我们的Snappy Ubuntu Core.这个autopilot的开关在默认的情况下是开的.我们可以通过snappy config来设置它.


我们可以通过如下的命令来查看它目前的设置:

方法1

(amd64)ubuntu@localhost:~$ snappy config ubuntu-core | grep autopilot
    autopilot: true

我们可以看到它目前的开关是开的,意味着我们的Snappy系统在联网的情况下会自动更新我们的系统.

(amd64)ubuntu@localhost:~$ sudo systemctl stop snappy-autopilot.timer
(amd64)ubuntu@localhost:~$ sudo systemctl disable snappy-autopilot.timer
Removed symlink /etc/systemd/system/multi-user.target.wants/snappy-autopilot.timer.
(amd64)ubuntu@localhost:~$ snappy config ubuntu-core | grep autoupdate
(amd64)ubuntu@localhost:~$ snappy config ubuntu-core | grep autopilot
    autopilot: false

如果我们只是想暂时关掉它,我们可以使用stop来代替上面的disable.

我们可以通过如下的方式来重新打开这个开关:

(amd64)ubuntu@localhost:~$ sudo systemctl enable snappy-autopilot.timer
Created symlink from /etc/systemd/system/multi-user.target.wants/snappy-autopilot.timer to /lib/systemd/system/snappy-autopilot.timer.
(amd64)ubuntu@localhost:~$ sudo systemctl start snappy-autopilot.timer
(amd64)ubuntu@localhost:~$ snappy config ubuntu-core | grep autopilot
    autopilot: true

更多信息请参阅文章"Autopilot mode".

方法2

另外一种方法是使用如下的办法:

$ snappy config ubuntu-core > my.yaml

然后,我们们修改"autopilot"项为我们想要的值,然后在打入如下的命令:

$ sudo snappy config ubuntu-core my.yaml

方法3

$  echo 'config: {ubuntu-core: {autopilot: off}}' | sudo snappy config ubuntu-core -

上述命令将关掉autopilot

$  echo 'config: {ubuntu-core: {autopilot: on}}' | sudo snappy config ubuntu-core -

上述命令将打开autopilot开关

我们可以通过下面的方法来检查当前的状态:

$ snappy config ubuntu-core | grep autopilot






评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值