Guest User

Untitled

a guest
Feb 19th, 2018
194
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.88 KB | None | 0 0
  1. # .bashrc / oodle
  2.  
  3. export PATH=$PATH:/service/bin:/service/local/bin:/service/local/sbin:/service/local/apache/bin:/service/external/java/bin:/service/external/mysql/bin:/opt/p4v/bin
  4. export LD_LIBRARY_PATH=/service/local/lib:/oracle/product/10.1.0.3/client/lib
  5. export ORACLE_HOME=/oracle/product/10.1.0.3/client
  6. export TNS_ADMIN=/oracle/network/admin
  7. export JAVA_HOME=/service/external/java
  8. export JAVAC=$JAVA_HOME/bin/javac
  9. export BUILD_TYPE=dev
  10. export P4USER=cte
  11. export P4CLIENT=cte
  12.  
  13. alias prod="ssh -p 21232 popcorn"
  14. alias tailerrors='tail -F /service/logs/error.php.`/bin/hostname | cut -f1 -d.`.`/bin/date +\%Y\%m\%d` | grep -P " (ERR|CRT|Fatal|Catchable) "'
  15. alias greptiming='grep -oP "t_[a-z]+=([^ ]+)"'
  16. alias web="/service/conf/generate_conf_files.pl && /service/scripts/control/httpd-dev"
  17. alias dbproxy="/service/scripts/control/httpd-db_proxy"
  18. alias geoindex="/service/scripts/control/geoindex"
  19. alias bandindex="/service/scripts/control/bandindex"
  20. alias suggestindex="/service/scripts/control/suggestindex"
  21. alias memcached="/service/scripts/init.d/memcached"
  22. alias database="/service/scripts/init.d/mysql"
  23. alias conf="/service/conf/generate_conf_files.pl"
  24. alias tunnel="/bin/cp -vf /service/conf.local/local.conf.tunnel /service/conf.local/local.conf && web restart && tunnelfast"
  25. alias notunnel="/bin/cp -vf /service/conf.local/local.conf.notunnel /service/conf.local/local.conf && web restart"
  26.  
  27. # args:
  28. # $1 branch
  29. function checkbuild {
  30. if [ "x$1" = "x" ]; then
  31. echo "checkbuild: Which branch?"
  32. return 0
  33. fi
  34. ssh oodle@build ls -lrt /build/built/$1 2>/dev/null | tail -2
  35. }
  36.  
  37. function latestfullbuild {
  38. if [ "x$1" = "x" ]; then
  39. echo "latestfullbuild: Which branch?"
  40. return 0
  41. fi
  42. checkbuild $1 | grep -oP $1-[0-9]+.tar.bz2
  43. }
  44.  
  45. function latestcodebuild {
  46. if [ "x$1" = "x" ]; then
  47. echo "latestcodebuild: Which branch?"
  48. return 0
  49. fi
  50. checkbuild $1 | grep -oP $1-[0-9]+-code.tar.bz2
  51. }
  52.  
  53. # args:
  54. # $1 tarball
  55. function isbuild {
  56. if [ "x$1" = "x" ]; then
  57. echo "isbuild: Which tarball?"
  58. return 0
  59. fi
  60. branch=`echo $1 | sed 's/-.*//'`
  61. tarball=`ssh oodle@build ls /build/built/$branch 2>/dev/null`
  62. if [ "x$tarball" = "x" ]; then
  63. return 0
  64. fi
  65. return 1
  66. }
  67.  
  68. # args:
  69. # $1 tarball
  70. function copybuild {
  71. if [ "x$1" = "x" ]; then
  72. echo "copybuild: Which tarball?"
  73. return 0
  74. fi
  75. isbuild $1
  76. exists=$?
  77. if [ $exists -eq 0 ]; then
  78. echo "Build $1 does not exist"
  79. return 0
  80. fi
  81. branch=`echo $1 | sed 's/-.*//'`
  82. echo "Copying $1 to localhost"
  83. scp -q oodle@build:/build/built/$branch/$1 /tmp/$1
  84. echo "Copying $1 to bastion"
  85. scp -P 21234 /tmp/$1 popcorn:~
  86. rm -vf /tmp/$1
  87. return 1
  88. }
  89.  
  90. # args:
  91. # $1 branch
  92. function copylatestfullbuild {
  93. if [ "x$1" = "x" ]; then
  94. echo "copylatestfullbuild: Which branch?"
  95. return 0
  96. fi
  97. latest=`latestfullbuild $1`
  98. if [ "x$latest" = "x" ]; then
  99. echo "copylatestfullbuild: $1 is not a branch"
  100. return 0;
  101. fi
  102. echo "The latest $1 branch build is $latest"
  103. copybuild $latest
  104. return 1
  105. }
  106.  
  107. # args:
  108. # $1 branch
  109. function copylatestcodebuild {
  110. if [ "x$1" = "x" ]; then
  111. echo "copylatestcodebuild: Which branch?"
  112. return 0
  113. fi
  114. latest=`latestcodebuild $1`
  115. if [ "x$latest" = "x" ]; then
  116. echo "copylatestcodebuild: $1 is not a branch"
  117. return 0;
  118. fi
  119. echo "The latest $1 branch build is $latest"
  120. copybuild $latest
  121. return 1
  122. }
  123.  
  124. # args:
  125. # $1 tarball
  126. # $2 service
  127. function pushbuild {
  128. if [ "x$1" = "x" ]; then
  129. echo "pushbuild: Which tarball?"
  130. return 0
  131. fi
  132. if [ "x$2" = "x" ]; then
  133. echo "pushbuild: Which service or machine (e.g. db_proxy, web, eros, etc.)?"
  134. return 0
  135. fi
  136. ssh -p 21232 popcorn ./push.pl $1 $2
  137. return 1
  138. }
  139.  
  140. # args:
  141. # $1 branch
  142. # $2 service
  143. function pushlatestfullbuild {
  144. copylatestfullbuild $1
  145. if [ $? = 0 ]; then
  146. echo "pushlatestfullbuild: copylatestfullbuild failed"
  147. return 0
  148. fi
  149. latest=`latestfullbuild $1`
  150. pushbuild $latest $2
  151. if [ $? = 0 ]; then
  152. echo "pushlatestfullbuild: pushbuild failed"
  153. return 0
  154. fi
  155. return 1
  156. }
  157.  
  158. # args:
  159. # $1 branch
  160. # $2 service
  161. function pushlatestcodebuild {
  162. copylatestcodebuild $1
  163. if [ $? = 0 ]; then
  164. echo "pushlatestcodebuild: copylatestcodebuild failed"
  165. return 0
  166. fi
  167. latest=`latestcodebuild $1`
  168. pushbuild $latest $2
  169. if [ $? = 0 ]; then
  170. echo "pushlatestcodebuild: pushbuild failed"
  171. return 0
  172. fi
  173. return 1
  174. }
  175.  
  176. function jweb {
  177. jx bones
  178. sleep 1
  179. jx chekov
  180. sleep 1
  181. jx kirk
  182. sleep 1
  183. jx magneto
  184. sleep 1
  185. jx spock
  186. sleep 1
  187. jx sulu
  188. sleep 1
  189. jx uhura
  190. }
  191.  
  192. function jdbp {
  193. jx riker
  194. sleep 1
  195. jx picard
  196. sleep 1
  197. jx worf
  198. }
  199.  
  200. function j {
  201. ssh -t -p 21232 popcorn "ssh -t oodle@$1"
  202. }
  203.  
  204. function jx {
  205. xterm -e "ssh -t -p 21232 popcorn \"ssh -t oodle@$1\"; bash" &
  206. }
Add Comment
Please, Sign In to add comment