Our legacy site: www.webwob.com   

Updates for running WebPageTest trhough Jenkins

I am still using WebPageTest locally and this page will add to the legacy pages with any new developments on my project.

    recent bash updates     jmeter updates*     jmeter v3.1     Start agent     WPT Jenkins job
    

Control the Agent uptime with a cmd/BASH script

We want to lauch the WebPageTest Agent at startup BUT also, tear it down at the end of the business working day.

Startup.bat
  rem start "" "c:\webpagetest\agent\urlBlast.exe"
  c:
  start "" "c:\Temp\caffeine.exe"
  cd c:\webpagetest\agent\dummynet
  call ipfw.cmd
  echo | call testmode.cmd
  cd ..
  
  start "" "c:\webpagetest\agent\wptdriver.exe"
  
  c:\cygwin64\bin\bash.exe /cygdrive/c/webpagetest/agent/kill_wpt2.sh 17 50
  pause
  
kill_wpt2.sh
You might want to exit before the shutdown stage with $3, $4

  if [ $# -ne 2 ] && [ $# -ne 4 ]; then
      echo $0: usage: . ./wpt_kill.sh hr min
      echo e.g.:
   echo $0: usage: . ./wpt_kill.sh 17 55
      echo "--------------------------------"
      hr=$(date +%H)
      min=$(date +%M)
      echo "hour is now ${hr}"
      echo "minutes are now ${min}"
      echo "--------------------------------"
   return 1
  fi
  
  echo "input hour is $1, input minutes is $2"
  wpt="yes"
  while [ "${wpt}" == "yes" ]; do
  
      date +%Y%m%d%H%M%S
      date +%H
      date +%M
      date +%S
  
      hr=$(date +%H)
      min=$(date +%M)
      sec=$(date +%S)
      #echo "hour is now ${hr}"
      #echo "minutes are now ${min}"
      echo "...................it is now ${hr}:${min}.${sec}"
      echo "Stopping at: $1-$2"
  
      if [ "$hr" -eq "17" ]
      then
          echo " hour is set"
      fi
  
      #echo here2
  
      if [ "$min" -eq "43" ]
      then
          echo " min is set"
      fi
  
  
      if [ "$hr" -eq "$1" ] && [ "$min" -eq "$2" ]; then
          #c:\cygwin64\bin\bash.exe kill_wpt.sh
  
          echo "TIME TO STOP WPT"
          
          tasklist > tasks.txt
          #cat tasks.txt
          echo --------------------------------
          echo
          echo --------------------------------------------------------
          echo
          
          
          ####grep 'wptwatchdog.exe' tasks.txt
          wptwatchdog=$(grep 'wptwatchdog.exe' tasks.txt | wc -l)
          echo wptwatchdog value is currently ${wptwatchdog}
          if [ "${wptwatchdog}" -ge "1" ]
          then
              echo wptwatchdog IS IN USE. Closing it down now
              Taskkill /IM wptwatchdog.exe /F
          else
              echo wptwatchdog not in use. Can carry on with this job.
          fi
          
          ####grep 'wptdriver.exe' tasks.txt
          wptdriver=$(grep 'wptdriver.exe' tasks.txt | wc -l)
          echo wptdriver value is currently ${wptdriver}
          if [ "${wptdriver}" -ge "1" ]
          then
              echo wptdriver IS IN USE. Closing it down now
              Taskkill /IM wptdriver.exe /F
          else
              echo wptdriver not in use. Can carry on with this job.
          fi
          
          wpt="no"
      fi
      
      if [ "${wpt}" == "yes" ]; then
          echo "wait 30 seconds"
          sleep 30
      fi
      
      ##test lines for development
      #if [ "$min" -eq "45" ]; then
      # echo "Finish here..."
      #    wpt="no"
      #fi
      
  done
  
  still_on="yes"
  end_at_h=$3
  end_at_m=$4
  while [ "${still_on}" == "yes" ]; do
  
      date +%Y%m%d%H%M%S
      date +%H
      date +%M
      date +%S
  
      hr=$(date +%H)
      min=$(date +%M)
      sec=$(date +%S)
      #echo "hour is now ${hr}"
      #echo "minutes are now ${min}"
      echo "...................it is now ${hr}:${min}.${sec}"
      echo "Shutting down at: $end_at_h-$end_at_m"
  
      if [ "$hr" -eq "17" ]
      then
          echo " hour is set"
      fi
  
      #echo here2
  
      if [ "$min" -eq "43" ]
      then
          echo " min is set"
      fi
  
  
      if [ "$hr" -eq "$end_at_h" ] && [ "$min" -eq "$end_at_m" ]; then
          #c:\cygwin64\bin\bash.exe kill_wpt.sh
  
          echo "TIME TO STOP MACHINE"
          
          /cygdrive/c/Windows/system32/shutdown.exe -s -f -t 900
          
          
          still_on="no"
      fi
      
      if [ "${still_on}" == "yes" ]; then
          echo "wait 30 seconds"
          sleep 30
      fi
      
      ##test lines for development
      #if [ "$min" -eq "45" ]; then
      # echo "Finish here..."
      #    wpt="no"
      #fi
      
  done