User-data scripts is not running on my custom AMI, but working in standard Amazon linux

后端 未结 11 1333
南方客
南方客 2020-12-08 02:15

I searched a lot of topic about \"user-data script is not working\" in these few days, but until now, I haven\'t gotten any idea about my case yet, please help me to figure

11条回答
  •  时光说笑
    2020-12-08 02:24

    I'm using CentOS and the logic for userdata there is simple:

    • In the file /etc/rc.local there is a call for a initial.sh script, but it looks for a flag first:

      if [ -f /var/tmp/initial ]; then
          /var/tmp/initial.sh &
      fi
      

    initial.sh is the file that does the execution of user-data, but in the end it deletes the flag. So, if you want your new AMI to execute user-data again, just create the flag again before create the image:

    touch /var/tmp/initial
    

提交回复
热议问题