SHARE
TWEET

Untitled

a guest Sep 11th, 2019 859 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ``#!/bin/sh
  2.  
  3. #
  4. #  
  5. #
  6. #  Created by deployuser on 7/10/14.
  7. #
  8. # Uncomment to run in debug mode
  9. #set -x
  10. # Configuration Section
  11. SLEEP="$SLEEP"
  12. F5_USER="$F5_USER"
  13. F5_PASSWORD="$F5_PASSWORD"
  14. TERMINATE="$TERMINATE_CONN_SLEEP"
  15. HEALTH_CHECK_PORT=8080
  16. rm -f deploy_host
  17. rm -f disable_host
  18. rm -f failed_version
  19. HOSTNAME=`cat $SELECT_ENV | awk -F, '{print $1}'`
  20. echo "$HOSTNAME" > deploy_host
  21. for i in `cat $SELECT_ENV`
  22. do
  23. IP=`echo "$i" | awk -F, '{NF--;$1=$1;sub(".*"$2,$1,$0)}1'`
  24. F5_INFO=`echo "$i" |  awk -F, ' { print ( $(NF) ) }'`
  25. for i in $IP
  26. do
  27. echo "********************************************************************************************************************"
  28. ./f5nodectl.pl $F5_INFO  443 "$F5_USER" "$F5_PASSWORD" "$i" disable
  29. echo "********************************************************************************************************************"
  30. done
  31. done
  32. echo "Waiting 10 secs for connections to drop"
  33. sleep 10
  34. echo "********************************************************************************************************************"
  35. echo "********************************************************************************************************************"
  36. echo "....................................................Stopping JBOSS.................................................."
  37. python deployer.py -f deploy_host -a userpass_$ENV "sudo /sbin/service jbossas stop"
  38. echo "********************************************************************************************************************"
  39. echo "********************************************************************************************************************"
  40. echo "....................................................Removing previous war..........................................."
  41. python deployer.py -f deploy_host -a userpass_$ENV "rm -f /opt/app/jboss/versions/jboss-eap-6.1/standalone/deployments/Coupons*"
  42. python deployer.py -f deploy_host -a userpass_$ENV "rm -rf /opt/app/jboss/home/standalone/tmp/*"
  43.  
  44. echo "********************************************************************************************************************"
  45. echo "********************************************************************************************************************"
  46. echo "....................................................Uploading war..............................................."
  47. python deployer.py -f deploy_host -a userpass_$ENV -s -c Coupons-$RELEASE_VERSION.war -D /opt/app/jboss/versions/jboss-eap-6.1/standalone/deployments
  48. echo "********************************************************************************************************************"
  49. echo "********************************************************************************************************************"
  50. echo "....................................................Starting JBOSS ................................................."
  51. python deployer.py -f deploy_host -a userpass_$ENV "sudo /sbin/service jbossas start > /dev/null 2>&1"
  52. echo "********************************************************************************************************************"
  53. echo "********************************************************************************************************************"
  54. echo "********************************************************************************************************************"
  55. echo "....................................................Waiting for APP to LOAD................................."
  56. sleep "$SLEEP"
  57. for hosts in "$HOSTNAME";
  58. do
  59. DEPLOY_VERSION=`curl http://"$hosts":"$HEALTH_CHECK_PORT"/cpn/version.txt | egrep [0-9]+.[0-9]+.[0-9]+`
  60. echo "********************************************************************************************************************"
  61. echo "....................................................Verifying Store01 on $hosts................................."
  62. if [ "$DEPLOY_VERSION" = "$RELEASE_VERSION" ];then
  63. echo "Version Check Successfull for "$hosts""
  64. else
  65. echo "Version Check Failed for "$hosts""
  66. echo ""$hosts"">> failed_version
  67. fi
  68. done
  69.     echo "********************************************************************************************************************"
  70.  
  71. echo "$SELECT_ENV" > "$SELECT_ENV"_clean
  72. cp "$SELECT_ENV" "$SELECT_ENV"_clean
  73. if [  -f failed_version ];
  74. then
  75. HOST_FAILED=`cat failed_version`
  76. for host_fail in $HOST_FAILED
  77. do
  78. grep -v "$host_fail" "$SELECT_ENV"_clean > "$SELECT_ENV"_clean2; mv "$SELECT_ENV"_clean2 "$SELECT_ENV"_clean
  79. done
  80. fi
  81.  
  82. if [  -f disable_host ];
  83. then
  84. HOST_DISABLED=`cat disable_host`
  85. echo "********************************************************************************************************************"
  86. echo "............................................The following IP's were OOS when the deployment started................."
  87. echo "$HOST_DISABLED"
  88. echo "............................................So leaving them OOS....................................................."
  89. echo "********************************************************************************************************************"
  90. for disable_host in "$HOST_DISABLED"
  91. do
  92. grep -v "$disable_host" "$SELECT_ENV"_clean > "$SELECT_ENV"_clean2; mv "$SELECT_ENV"_clean2 "$SELECT_ENV"_clean
  93. done
  94. fi
  95. echo "********************************************************************************************************************"
  96. echo "............................................Putting servers back in service........................................."
  97. echo "********************************************************************************************************************"
  98. for i in `cat "$SELECT_ENV"_clean`
  99. do
  100. IP=`echo "$i" | awk -F, '{NF--;$1=$1;sub(".*"$2,$1,$0)}1'`
  101. F5_INFO=`echo "$i" |  awk -F, ' { print ( $(NF) ) }'`
  102. for i in $IP
  103. do
  104. echo "********************************************************************************************************************"
  105. ./f5nodectl.pl $F5_INFO  443 "$F5_USER" "$F5_PASSWORD" "$i" enable
  106. echo "********************************************************************************************************************"
  107. done
  108. done
  109.  
  110. if [  -f failed_version ];then
  111. FAILED=`cat failed_version | sort -u`
  112. if [ -n "$FAILED" ];then
  113. echo "********************************************************************************************************************"
  114. echo "............................................Deployment failed on...................................................."
  115. echo "$FAILED"
  116. echo "********************************************************************************************************************"
  117. exit 1
  118. fi
  119. fi
  120. rm -f "$SELECT_ENV"
  121. rm -f "$SELECT_ENV"_clean
  122. exit 0
  123. ```
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top