Our legacy site: www.webwob.com   

VUgen scripting methods (page 3)

This page will cover more BASH scripting methods, following on from the legacy site pages.

     LoadRunner CI/CD      *_LR_CI_*      LR_CI_+      Email_out      Email_in      Cookies 1      TUTORIAL      sprintf      debug      VUgen      Kill -9      disk space      AWS S3      dig (DNS++)      substitute      curl with timings      LR_Jenkins_graphs     

    

Areas covered on this page

1: Root DNS lookup to list servers

2: Copy over directories to a new location (cp -ndpR)

3: Human readable disk sizes etc.


I use this to see quickly see how many servers are deployed in my test environment

Root DNS lookup to list servers  

  $ dig +short all_web.environment.channel.com
  www.all_web-environment.our_cloud.co.uk.
  all_web-environment-v1p0p409-00.our_cloud.co.uk.
  www.all_web-environment-v1p0p409-00.our_cloud.co.uk.
  all_web-environment-v1p0p409-00-56xxxxxx13.eu-west-1.elb.amazonaws.com.
  xx.16.186.zz
  xx.17.229.kkk
  yy.72.9.mm
  
  
bind-utils needs adding to cygwin


      Example 2:
      
for i in {1..9}; do dig +short app0$i.xxxv1-prod.s7cloud.co.uk; done

      ( I put
xxxv1-prod
in there, change that for the farm/environment you’re interested in. )

      
Example3 including output:

      $ for i in {1..9}; do dig +short app0$i.xxxv1-stage.s7cloud.co.uk; done
      app01.xxxv1-stage-v1p14p64-31.s7cloud.co.uk.
      34.ppp.qqq.107
      app02.xxxv1-stage-v1p14p64-31.s7cloud.co.uk.
      34.ppp.rrr.92
      app03.xxxv1-stage-v1p14p64-31.s7cloud.co.uk.
      34.sss.tt.159
      app04.xxxv1-stage-v1p14p64-17.s7cloud.co.uk.
      app05.xxxv1-stage-v1p14p64-17.s7cloud.co.uk.
      app06.xxxv1-stage-v1p14p64-17.s7cloud.co.uk.
      
If there’s no IP address then there’s no app server.. it looks like there are some CNAMEs for app04,5,6 but no corresponding A records, I would expect this is from a previous scale up followed by scale back down again. Should it go back up to 6 servers, those CNAMEs would be replaced.


  
Get count of pure IPs returned  

  dig +short allweb.stage.channel.com | grep -o '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}' | wc -l
  
  
Extras

nslookup queries the DNS entry for a domain name or ip address
tracert queries the route for a domain name or ip address. ( adding -h 3 limits the hops to 3, for example )

    
    

Copy over directories to a new location

Preserve links. Don't overwrite existing files.

  ------------------------------------------------------------
  
  cp -ndpR <source> <destination>
  
  NOTES:
  -p same as --preserve=mode,ownership,timestamps
  -n, --no-clobber do not overwrite an existing file
  -d same as --no-dereference --preserve=links
  -R, -r, --recursive copy directories recursively
  
  --------------------------------------------------------------


    
    

Human readable disk sizes etc.

  ------------------------------------------------------------
  df -H
  du -sh */   
  ls -lh   

  NOTES:
  df - display free disk space with df viewed as human readable.
  du – displaying disk usage for a specific file, folder, directory
  ls – for the generic list command, you’ll need to attach -h to another flag, like -l:
  --------------------------------------------------------------

Screenshot