I've created a custom Amazon AMI (Fedora) runs a few scripts and then shuts down.
The problem with AMI's is that if my code changes there has to be a way for the AMI instance to get the latest scripts before it executes them.
I wrote a shell script & put it in /etc/init.d/nt_startup
To keep the code up to date, I execute a "git pull" shell script in my code repository and then execute the script.
The problem is, the "git pull" doesn't seem to run when an instance boots up, but the python script runs just fine. Not sure what I'm missing... here's the startup script:
#!/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 "/usr/scripts/code/git_latest" shell script looks like this:
#pulls in the latest code from the repository
cd /usr/scripts/code
sudo git pull
It should be pulling down the latest "process.py" script.
The strange thing is that if I ssh into my instance and execute the startup script manually (/etc/init.d/nt_startup "start"), the git script works just fine.
Am I missing something?