系统单元:与命令:start(cloud-config)

我在CoreOS的cloud-config文件中configurationsystemd。 如果我正确理解这一点,我有两种启动单元的方法:

方法1,使用[Install] (如数字海洋指南中所述 ):

 - name: initialize_data content: | [Unit] Description=Run a command [Service] Type=oneshot ExecStart=/usr/bin/mkdir /foo [Install] WantedBy=multi-user.target 

方法2,删除[Install] -section并使用command: start

 - name: initialize_data command: start content: | [Unit] Description=Run a command [Service] Type=oneshot ExecStart=/usr/bin/mkdir /foo 

是否有使用command: start单位的任何缺点command: start ? 我得到,我无法控制它将开始之后,但其他什么? 它会尊重[Unit]指令,如Requires=After=

它出现在CoreOS上几乎没有什么区别。 在其他Linux发行版上使用systemd时,区别在于start只启动一个服务,不会导致它在启动时启动 。 这是通过处理systemd文件的[Install]部分来实现的。

但是,CoreOS文档说,每次启动时都会处理cloud-config命令。 所以通过指定一个服务来start cloud-config ,服务也基本上被启用

CoreOS可能包含两个选项,使您可以充分灵活地访问两个systemdfunction。