I created a custom AMA (Fedora) Amazon that runs several scripts and then shuts down.
The problem with AMI is that if my code changes, there must be a way for the AMI instance to get the latest scripts before it executes them.
I wrote a shell script and put it in /etc/init.d/nt_startup
To update the code, I run git pull shell script in my code repository and then execute the script.
The problem is that git pull does not start when the instance loads, but the python script works just fine. Not sure what I am missing ... here's the script run:
#!/bin/bash # # ec2 Startup script for EC2 machines # # chkconfig: 345 99 02 # description: Script used to issue startup and shutdown commands. # if [ "$1" = "start" ]; then /usr/scripts/code/git_latest python /usr/scripts/code/process.py exit fi if [ "$1" = "stop" ]; then #nothing exit fi
The shell /usr/scripts/code/git_latest script looks like this:
It should flush the last process.py script.
It is strange that if I ssh in my instance and start the script launch manually ( /etc/init.d/nt_startup "start" ), the git script works just fine.
Did I miss something?
git shell amazon-ec2 fedora
Mark
source share