作者:落了个小妞农_602 | 来源:互联网 | 2023-05-18 19:50
Ihaveanec2instanceabc1(ubuntu)andIcreateimagefromabc1.Then,Ilaunchanewinstanceabc
I have an ec2 instance"abc1"(ubuntu) and I create image from abc1. Then,I launch a new instance "abc2" from abc1 image. I want abc2 to run the script when it will be launched.
So,I write the text in userdata:
我有一个ec2实例“abc1”(ubuntu),我从abc1创建图像。然后,我从abc1映像启动一个新的实例“abc2”。我希望abc2在脚本启动时运行它。我用userdata写文本:
#!/bin/bash
cd ~/env/xxx/bin/
source activate
python3.6 ~/env/xxx/source/test.py
I manually use these commands,it's valid.However,it doesn't work when using userdata automatically. Does anyone know how to adjust my settings? Thanks a lot.
我手动使用这些命令,它是有效的。但是,当自动使用userdata时,它不能工作。有人知道怎么调整我的设置吗?非常感谢。
1 个解决方案