开发者

In Amazon EC2, how do I make it run a python script when I "clone" that instance?

开发者 https://www.devze.com 2023-01-04 02:48 出处:网络
Suppose I have a script in /home/myuser/go.py How do I run that script, when a new instance is booted?(I\'m used to using the开发者_如何学运维 point-and-click control panel Amazon has...)I\'m gonn

Suppose I have a script in

/home/myuser/go.py

How do I run that script, when a new instance is booted? (I'm used to using the开发者_如何学运维 point-and-click control panel Amazon has...)


I'm gonna try my nonexistent Linux skills here - create a shell script that runs your go.py and add a symlink to the shell script in /etc/init.d/

/home/myser/go.sh

#!/bin/bash
python /home/myuser/go.py

symlink

ln -s /etc/init.d/go.sh /home/myuser/go.sh

After reading up a bit myself, /etc/rc.local is probably a better place for this. Just edit it and add /home/myuser/go.sh there (again, make sure your go.sh is executable).

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号