Great, I will try this out. What do you mean enable rebuild in /etc/aws/hosts?
Nathan On Sat, Mar 14, 2009 at 6:50 PM, jdMelton <[email protected]> wrote: > > Nathan, > > I do not know if the following will work for you if you need either > the Public DNS or Elastic IP Addresses. > > This is a cut-down version of a bash script that I run to get all of > the app role private IP addresses: > > #!/bin/bash > # jdMelton > # > # Report undefined variables. > shopt -s -o nounset > # > # Get the app server IP addresses. > # If this script runs during a rebuild of /etc/aws/hosts, then ls will > return > # an error or the directory may be empty. So, loop until a count is > obtained. > declare -i APP_SERVER_COUNT=0 > declare -a APP_DIRECTORY_ARRAY > while [ $APP_SERVER_COUNT -lt 1 ]; do > APP_DIRECTORY_ARRAY=($(ls /etc/aws/hosts/app 2> /dev/null)) > app_server_count=${#app_directory_arr...@]} > if [ $APP_SERVER_COUNT -lt 1 ]; then > echo -n 'APP_SERVER_COUNT < 1 ' >> $MYLOGFILE; date >> > $MYLOGFILE > sleep 60s > fi > done > > # Do something useful here. This just shows the results. > declare APP_SERVER > for APP_SERVER in ${app_directory_arr...@]}; do > echo 'app role = '$APP_SERVER > done > > > This can be repeated for www or any of the other roles. > You could do something like this in php as well. > I believe that you do need to enable rebuild /etc/aws/hosts in > scripting to keep these up do date. > > On Mar 13, 11:59 pm, Nathan Palmer <[email protected]> wrote: >> That looks like it could work I'm just not sure how to use it. What >> would be the easiest way to put this to use possibly in a php script? >> I'm not sure how to use it in that way. I ran those commands from the >> shell and got a result but I need to somehow get that information, >> parse the xml and use it in a useful way. Can anyone point me to any >> existing script snippets so I can see how I can apply it to my >> situation? >> >> Thanks, >> >> Nathan >> >> On Fri, Mar 13, 2009 at 7:43 AM, Nickolas Toursky <[email protected]> wrote: >> >> > Hi Nathan, >> >> > Consider using QueryEnv Scalr API to do this (more details at >> >http://code.google.com/p/scalr/wiki/QueryEnv). >> > "list-roles" query response contains indexes for every instance within >> > a role. >> >> > Nick >> >> > On Mar 13, 4:18 am, Nathan Palmer <[email protected]> wrote: >> >> I'm trying to setup a script for my app role that will connect to the >> >> gluster server that was created on the master role. I can start the >> >> gluster server based on the %instance_index% = 1 but each additional >> >> node that is started needs to get the IP address of the master node in >> >> order to setup it's gluster configuration. Is there a way to do this? >> >> >> Thanks, >> >> >> Nathan > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "scalr-discuss" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/scalr-discuss?hl=en -~----------~----~----~----~------~----~------~--~---
