更新时间:2025-03-31 GMT+08:00

查看Cloud-Init服务状态

SUSE 11 SP4

  1. 执行命令:yast,使用上下键选择“System”。
  2. 按“Tab”键后,然后选择“System Services (Runlevel)”。
  3. 按“Enter”,显示如下图,可以看到Cloud-Init的四个阶段的服务已被自启动,其中“YES”为自启动,“No”为没有被自启动。如果没有自启动,按照图中的功能键将其添加到自启动中。

SUSE 12 SP1

  1. 执行以下命令,检查Cloud-Init开机自启动服务是否设置成功。

    查看Cloud-Init服务状态,执行yast命令,使用上下键,选择“System”,然后按“Tab”键,使用上下键选择“System Manager”。

  2. 可以看到上图中Cloud-Init的四个服务均为“enable”,表示已经自启动服务。active表示处于开启状态。对于Cloud-Init四个阶段的服务,如果某个服务没有自启动,首先用上下键选中,然后按“Tab”,选中“Enable/Disable”,即可设置该服务为自启动服务。

SUSE 12 SP2/SUSE 12 SP3/SUSE 15/Oracle Linux 7系列/Red Hat 7系列/CentOS 7系列/CentOS 8系列/XenServer 7系列

  1. 执行以下命令,检查Cloud-Init开机自启动服务是否设置成功。

    systemctl status cloud-init-local

    systemctl status cloud-init

    systemctl status cloud-config

    systemctl status cloud-final

  2. 下图所示回显信息“enabled”,说明开机自启动服务已经设置成功。

    如果没有设置开机自启动,则执行以下命令开启对应阶段的开机自启动服务:

    systemctl enable cloud-init-local

    systemctl enable cloud-init

    systemctl enable cloud-config

    systemctl enable cloud-final

  3. 执行以下命令,运行Cloud-Init服务命令。

    systemctl start cloud-init-local

    systemctl start cloud-init

    systemctl start cloud-config

    systemctl start cloud-final

  4. 执行步骤1中命令,查看Cloud-Init状态是否为active,如图。

EulerOS/OpenEuler

  1. 执行以下命令,检查Cloud-Init开机自启动服务是否设置成功。

    systemctl status cloud-init-local

    systemctl status cloud-init

    systemctl status cloud-config

    systemctl status cloud-final

  2. 下图所示回显信息“enabled”,说明开机自启动服务已经设置成功。

    如果没有设置开机自启动,则执行以下命令开启对应阶段的开机自启动服务:

    systemctl enable cloud-init-local

    systemctl enable cloud-init

    systemctl enable cloud-config

    systemctl enable cloud-final

  3. 执行以下命令,运行Cloud-Init服务命令。

    systemctl start cloud-init-local

    systemctl start cloud-init

    systemctl start cloud-config

    systemctl start cloud-final

  4. 执行步骤1中命令,查看Cloud-Init状态是否为active,如图。

Red Hat 6系列/CentOS 6系列/Oracle Linux 6系列

  1. 执行下列命令:

    chkconfig --list | grep cloud

    如下图,若红框部分处于“on”状态,则表示服务已被自启动。

  2. 如果Cloud-Init四个阶段的服务未被自启动,在命令行执行:

    chkconfig cloud-init on

    chkconfig cloud-init-local on

    chkconfig cloud-config on

    chkconfig cloud-final on

Ubuntu 16.04/Ubuntu 18.04

  1. 执行下列命令:

    systemctl status cloud-init

    systemctl status cloud-init-local

    systemctl status cloud-config

    systemctl status cloud-final

    如下图,若红框部分是“enable”状态,则表示服务已被自启动。

  2. 如果Cloud-Init四个阶段的服务未被自启动,在命令行执行:

    systemctl enable cloud-init

    systemctl enable cloud-init-local

    systemctl enable cloud-config

    systemctl enable cloud-final

  3. 执行以下命令,运行Cloud-Init服务命令。

    systemctl start cloud-init-local

    systemctl start cloud-init

    systemctl start cloud-config

    systemctl start cloud-final

  4. 执行步骤1中命令,查看Cloud-Init状态是否为active,如图。

Ubuntu 14.04

执行下列命令:

initctl status cloud-init

initctl status cloud-init-local

initctl status cloud-config

initctl status cloud-final

如果安装成功,则回显Cloud-Init组件安装信息。

[root@ubuntu:~]# initctl status cloud-init
cloud-init stop/waiting
[root@ubuntu:~]# initctl status cloud-init-local
cloud-init-local stop/waiting
[root@ubuntu:~]# initctl status cloud-config
cloud-config stop/waiting
[root@ubuntu:~]# initctl status cloud-final
cloud-final stop/waiting