Thinking Out Loud

April 14, 2022

Gather Oracle ExaData Cloud Service (ExaCS) Region/AD From Hostname

Filed under: Oracle_Cloud,shell scripting — mdinh @ 12:43 am
Here are all the ExaData hosts without the instance# as it does not make a difference in the results.

### cn is Client Name abbreviation.
cnexaashad2x8na-xxxxx 
cnexaashad3x8na-xxxxx 
cnexafraad2x8m-xxxxx-yyyyy 
cnexalonad2x8m-xxxxx-yyyyy 
cnexaphxad2x8m-xxxxx-yyyyy 
cnexasydad1x8m-xxxxx-yyyyy

### Shell Script to extract info:
kucubiwopeto@pc-3fbecf:~$ cat exacs_name.sh
StringVal="cnexaashad2x8na-xxxxx cnexaashad3x8na-xxxxx cnexafraad2x8m-xxxxx-yyyyy cnexalonad2x8m-xxxxx-yyyyy cnexaphxad2x8m-xxxxx-yyyyy cnexasydad1x8m-xxxxx-yyyyy"
for val in $StringVal; do
  cloud_service=${val:2:3}
  region=${val:5:3}
  availability_domain=${val:8:3}
  echo $cloud_service-$region-$availability_domain
done
exit
kucubiwopeto@pc-3fbecf:~$

### Results:
kucubiwopeto@pc-3fbecf:~$ ./exacs_name.sh
exa-ash-ad2
exa-ash-ad3
exa-fra-ad2
exa-lon-ad2
exa-phx-ad2
exa-syd-ad1
kucubiwopeto@pc-3fbecf:~$

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Create a free website or blog at WordPress.com.

%d bloggers like this: