我试图让以下脚本在启动GCE时在CentOS实例上运行。 我在实例名称和下面的脚本上设置了自定义元数据“startup-script”作为值。谷歌计算引擎启动脚本:启动时没有运行
该脚本不启动时,重新启动执行或当我运行/ usr /共享/谷歌/运行启动的脚本,但如果我实例上的本地创建它不执行和执行有
什么明显我错过了什么?
#! /bin/bash
# Installs apache and a custom homepage
# 1234567 123456
#Get this servers name from the metadata server and use the header to authenticate
THIS_SERVER_NAME=$(curl http://metadata/computeMetadata/v1/instance/hostname -H "X-Google-Metadata-Request: True")
#Turn off IPtables firewall that comes installed
service iptables stop
#Install apache
yum install -y httpd
#start apache
service httpd start
#create custom default homepage for this server
cat <<EOF > /var/www/html/index.html
<html><body><h1>Hello World</h1>
<p>This is Server: $THIS_SERVER_NAME</p>
</body></html>
EOF
我也尝试从一个桶中加载脚本,至少在/ var/log/google/log中显示我脚本已下载,但它仍然没有实际执行任务。我需要从gcutil设置权限吗? – mobcdi
还添加了--service_account_scopes = storage-ro到gcutil命令,但仍然没有快乐 – mobcdi
我有类似的问题,但我的脚本启动后,我重新启动,但不是当创建实例时.... – brdido