自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

如何在Linux啟動(dòng)時(shí)自動(dòng)啟動(dòng)LXD容器

系統(tǒng) Linux
當(dāng) LXD 在啟動(dòng)時(shí)運(yùn)行,你就可以隨時(shí)啟動(dòng)容器。你需要將 boot.autostart 設(shè)置為 true。你可以使用 boot.autostart.priority(默認(rèn)值為 0)選項(xiàng)來定義啟動(dòng)容器的順序(從最高開始)。你也可以使用 boot.autostart.delay(默認(rèn)值 0)選項(xiàng)定義在啟動(dòng)一個(gè)容器后等待幾秒后啟動(dòng)另一個(gè)容器。

 

 

[[214506]]

Q:我正在使用基于 LXD(“Linux 容器”)的虛擬機(jī)。如何在 Linux 系統(tǒng)中啟動(dòng)時(shí)自動(dòng)啟動(dòng) LXD 容器?

當(dāng) LXD 在啟動(dòng)時(shí)運(yùn)行,你就可以隨時(shí)啟動(dòng)容器。你需要將 boot.autostart 設(shè)置為 true。你可以使用 boot.autostart.priority(默認(rèn)值為 0)選項(xiàng)來定義啟動(dòng)容器的順序(從***開始)。你也可以使用 boot.autostart.delay(默認(rèn)值 0)選項(xiàng)定義在啟動(dòng)一個(gè)容器后等待幾秒后啟動(dòng)另一個(gè)容器。

 

語(yǔ)法

上面討論的關(guān)鍵字可以使用 lxc 工具用下面的語(yǔ)法來設(shè)置:

  1. $ lxc config set {vm-name} {key} {value}
  2. $ lxc config set {vm-name} boot.autostart {true|false}
  3. $ lxc config set {vm-name} boot.autostart.priority integer
  4. $ lxc config set {vm-name} boot.autostart.delay integer

 

如何在 Ubuntu Linux 16.10 中讓 LXD 容器在啟動(dòng)時(shí)啟動(dòng)?

輸入以下命令:

  1. $ lxc config set {vm-name} boot.autostart true

設(shè)置一個(gè) LXD 容器名稱 “nginx-vm” 以在啟動(dòng)時(shí)啟動(dòng)

  1. $ lxc config set nginx-vm boot.autostart true

你可以使用以下語(yǔ)法驗(yàn)證設(shè)置:

  1. $ lxc config get {vm-name} boot.autostart
  2. $ lxc config get nginx-vm boot.autostart

示例輸出:

  1. true

你可以使用下面的語(yǔ)法在啟動(dòng)容器后等待 10 秒鐘后啟動(dòng)另一個(gè)容器:

  1. $ lxc config set nginx-vm boot.autostart.delay 10

***,通過設(shè)置***值來定義啟動(dòng)容器的順序。確保 dbvm 容器首先啟動(dòng),然后再啟動(dòng) nginxvm。

  1. $ lxc config set db_vm boot.autostart.priority 100
  2. $ lxc config set nginx_vm boot.autostart.priority 99

使用下面的 bash 循環(huán)在 Linux 上查看所有配置值:

  1. #!/bin/bash
  2. echo 'The current values of each vm boot parameters:'
  3. for c in db_vm nginx_vm memcache_vm
  4. do
  5. echo "*** VM: $c ***"
  6. for v in boot.autostart boot.autostart.priority boot.autostart.delay
  7. do
  8. echo "Key: $v => $(lxc config get $c $v) "
  9. done
  10. echo ""
  11. done

示例輸出:

Fig.01: Get autostarting LXD containers values using a bash shell script

Fig.01: Get autostarting LXD containers values using a bash shell script 

責(zé)任編輯:龐桂玉 來源: Linux中國(guó)
相關(guān)推薦

2017-03-10 10:37:16

Linux命令腳本

2010-05-25 18:57:42

啟動(dòng)postfix

2020-06-04 17:00:37

Linux命令腳本

2024-04-07 08:06:37

Spring事件應(yīng)用程序

2014-01-06 11:24:51

Linux桌面啟動(dòng)程序

2022-02-17 08:20:17

Spring執(zhí)行代碼SpringBoot

2020-10-26 10:11:45

Jupyter Not早起Python開發(fā)

2018-11-23 15:25:00

Windows10Windows啟動(dòng)時(shí)間

2009-06-17 17:06:20

2020-02-12 08:50:05

Linux命令啟動(dòng)時(shí)間

2021-08-26 13:55:45

systemdLinux目標(biāo)

2021-08-26 11:09:51

systemdLinux

2010-05-06 18:42:15

Unix系統(tǒng)

2019-04-22 12:25:40

UbuntuLinux IP地址

2021-11-04 12:42:55

RocketMQ啟動(dòng)消費(fèi)

2018-08-22 10:55:53

WindowsWindows 10系統(tǒng)故障

2018-10-19 10:45:13

WindowsWindows10應(yīng)用程序

2019-03-25 10:30:11

Windows 10 Windows程序

2022-05-04 17:50:51

Linux

2018-05-21 08:52:15

Linux應(yīng)用程序啟動(dòng)時(shí)間
點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號(hào)