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

Suppose I have a script in

/home/myuser/go.py

How to run this script when a new instance is loading? (I'm used to using the point-and-click control panel Amazon has ...)

+3
source share
1 answer

I'm going to try my nonexistent Linux skills here - create a shell script that launches yours go.pyand adds a symlink to the shell script in/etc/init.d/

/home/myser/go.sh

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

symbolic

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

, /etc/rc.local, , . /home/myuser/go.sh ( , go.sh ).

+2

Source: https://habr.com/ru/post/1751166/


All Articles