Advertisement
Guest User

Untitled

a guest
Aug 17th, 2017
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.76 KB | None | 0 0
  1. [root@staging-linux03 ~]# cat testsolr.sh
  2. #!/bin/bash
  3.  
  4. . /etc/init.d/cr-env
  5.  
  6. # solr
  7. dbuser=`grep -m 1 user-name /var/lib/jboss/server/web/deploy/CR_${crEnv}-ds.xml | sed -e 's/^[ \t]*//' -e 's/<user-name>//' -e 's/<\/user-name>//'`
  8. dbpass=`grep -m 1 password /var/lib/jboss/server/web/deploy/CR_${crEnv}-ds.xml | sed -e 's/^[ \t]*//' -e 's/<password>//' -e 's/<\/password>//'`
  9. dbhost=`grep -m 1 'connection-url' /var/lib/jboss/server/web/deploy/CR_${crEnv}-ds.xml | sed -e 's/^[ \t]*//' -e 's|<connection-url>jdbc\:mysql\://||' -e 's|\:.*$||'`
  10. dbport=`grep -m 1 'connection-url' /var/lib/jboss/server/web/deploy/CR_${crEnv}-ds.xml | sed -e 's/^[ \t]*//' -e 's|<connection-url>jdbc\:mysql\://||' -e 's|^.*\:||' -e 's|/.*$||'`
  11. dbname=`grep -m 1 'connection-url' /var/lib/jboss/server/web/deploy/CR_${crEnv}-ds.xml | sed -e 's/^[ \t]*//' -e 's|<connection-url>jdbc\:mysql\://||' -e 's|^.*[0-9][0-9][0-9][0-9]/||' -e 's|<.*$||'`
  12. echo "lf"
  13.  
  14. cmd="mtest -u ${dbuser} -p ${dbpass} -h ${dbhost} -P ${dbport} ${dbname}"
  15. # -se "select max(CustomerID) from tbl_Customer"
  16. echo "command: $cmd"
  17. #maxcust=`$cmd | grep -v CustomerID`
  18.  
  19. dbpass="testpass"
  20. dbhost="testhost"
  21. dbname="testname"
  22. dbport="3306"
  23.  
  24. echo "dbuser: $dbuser"
  25. echo "dbpass: $dbpass"
  26. echo "dbhost: $dbhost"
  27. echo "dbport: $dbport"
  28. echo "dbname: $dbname"
  29. echo "db cmd: mysql -u${dbuser} -p${dbpass} -h ${dbhost} -P ${dbport} ${dbname} -se \"select max(CustomerID) from tbl_Customer\" | grep -v CustomerID"
  30. echo "maxcust: $maxcust"
  31.  
  32. [root@staging-linux03 ~]# ./testsolr.sh
  33. lf
  34. -h localhost -P 3306 chrome_expense_staging1
  35. dbuser: chrome
  36. dbpass: testpass
  37. dbhost: testhost
  38. dbport: 3306
  39. dbname: testname
  40. -ptestpass -h testhost -P 3306 testname -se "select max(CustomerID) from tbl_Customer" | grep -v CustomerID
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement