【发布时间】:2016-07-19 23:54:17
【问题描述】:
ubuntu 14 亚马逊AWS
我正在尝试在启动时附加和安装卷 我在 /etc/init 中有以下 .conf 文件
start on started network-interface
script
/usr/bin/aws ec2 attach-volume ... && /bin/mount ... || /bin/mount ...
end script
问题是附加是异步的,可能需要任意时间
所以如果我第一次启动一个实例 它附加卷,但如果我重新启动它将在安装时失败然后它会 附加失败,因为它已经附加,然后安装将起作用 任何后续重新启动都可以解决问题是第一次当卷 需要附上
所以我想我需要第二个脚本(不确定我是否可以在同一个 .conf 文件中执行此操作) 像
start on started network-interface
script
////try to attach it if we get an error then its already attached so mount it
/usr/bin/aws ec2 attach-volume ... || /bin/mount ...
end script
start on WHEN volumen IS attached (no idea what i need here)
script
///new device attached to system mount it
/bin/mount ...
end script
所以我的问题是我如何知道设备/卷何时连接到系统 我希望在 apache mysql 之类的东西开始之前可以完成所有这些工作 如果不是,我还需要重新启动它们或更好地延迟 apache mysql 的启动......直到我的安装准备好 p.s 我需要以这种方式附加多个卷
感谢任何建议
【问题讨论】:
-
您是否有理由不使用 /etc/fstab 在启动时自动挂载文件系统?
-
我在那里做其他事情,附加 ip 设置 dns 我想把它全部放在一个地方,fstab 无法解决在我没有附加卷之前没有任何东西可以挂载的问题
标签: amazon-web-services upstart