I use AMI Amazon Linux AMI and make some custom changes (added on axis2server server etc.) and save it as a new AMI. Now what I want to do is when the AMI loads, it starts axis2server (i.e..axis2server should start automatically when the instance loads). To do this, I used the init script, as shown below, and ran the following command:
chkconfig --add axisservice
But when I start a new instance from my image, the axial server does not start.
I just need to execute script / home / ec2-user / axis2-1.6.1 / bin / axis2server.sh at startup. Did I miss something?
#! /bin/sh # Basic support for IRIX style chkconfig ### # chkconfig: 235 98 55 # description: Manages the services you are controlling with the chkconfig command ### case "$1" in start) echo -n "Starting axisservice" touch ~/temp.txt cd /home/ec2-user/axis2-1.6.1/bin ./axis2server.sh & echo "." ;; stop) echo -n "Stopping axisservice" echo "." ;; *) echo "Usage: /sbin/service axisservice {start|stop}" exit 1 esac exit 0
I went through https://help.ubuntu.com/community/CloudInit and it provides a mechanism called User-Data Scripts where the user can execute the script when the script is run.
$ euca-run-instances --key mykey --user-data-file myscript.sh ami-axxxx
This is a command line parameter, and I want something like when I run the instance through the user interface, the script should be running. Therefore, I think that the above option cannot be used in my case. Please correct me if I am wrong.
Thank you N.
source share