最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Cloud

运维笔记admin34浏览0评论

Cloud

Cloud

Cloud-init per-boot脚本什么都不做(Cloud-init per-boot script doing nothing)

我是cloud-init的新手,我的最终目标是每次EC2竞价型实例变为活动时运行R脚本,但为了测试它,我创建了一个按需的Ubuntu 12.04实例,并创建了一个简单的脚本,但之后没有任何反应重启。 以下是我采取的步骤:

推出了新的Ubunut 12.04实例 导航到/var/lib/cloud/scripts/per-boot sudo vi script.sh 添加了以下代码:

#!/ bin / sh的 回声“测试”

sudo reboot

此时我认为我应该在实例重新启动时看到“测试”打印,但那里什么都没有。 我去看看/var/log/cloud-init.log但没有任何错误或任何异常。

我显然遗漏了一些东西,所以任何关于正确方向的小费都会非常感激!

谢谢!

I am new to cloud-init, my final goal is to run an R script each time an EC2 Spot Instance becomes active, but in order to test it I created an on-demand Ubuntu 12.04 instance and created a simple script but nothing happens after reboot. Here are the steps I took:

Launched the new Ubunut 12.04 instance Navigate to /var/lib/cloud/scripts/per-boot sudo vi script.sh Added the following code:

#!/bin/sh echo "test"

sudo reboot

At this point I thought I should see a "test" print when the instance reboots, but there is nothing there. I went to take a look at /var/log/cloud-init.log but there is no error or anything out of the ordinary.

I am clearly missing something so any tip in the right direction will be much appreciated!

Thanks!

最满意答案

除非脚本用户设置为始终运行,否则它不会运行。 有关更多详细信息,请参阅此答案 (有关如何在重新启动时运行脚本的说明)。

It won't run unless the scripts user is set to always run. See this answer for more details (and for instructions on how to get scripts to run on reboot, generally).

发布评论

评论列表(0)

  1. 暂无评论