read cnf/jra xml with xmllint
This commit is contained in:
parent
c8c6922b1f
commit
f09584485f
1 changed files with 23 additions and 6 deletions
29
functions.sh
29
functions.sh
|
@ -1121,9 +1121,12 @@ function getdbcreds_jra () {
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
DB_URL="$(grep -oPm1 "(?<=<url>)[^<]+" ${DB_FILE})"
|
#DB_URL="$(grep -oPm1 "(?<=<url>)[^<]+" ${DB_FILE})"
|
||||||
DB_USER="$(grep -oPm1 "(?<=<username>)[^<]+" ${DB_FILE})"
|
#DB_USER="$(grep -oPm1 "(?<=<username>)[^<]+" ${DB_FILE})"
|
||||||
DB_PWD="$(grep -oPm1 "(?<=<password>)[^<]+" ${DB_FILE})"
|
#DB_PWD="$(grep -oPm1 "(?<=<password>)[^<]+" ${DB_FILE})"
|
||||||
|
DB_URL="$(xmllint --xpath "jira-database-config/jdbc-datasource/url/text()" ${DB_FILE})"
|
||||||
|
DB_USER="$(xmllint --xpath "jira-database-config/jdbc-datasource/username/text()" ${DB_FILE})"
|
||||||
|
DB_PWD="$(xmllint --xpath "jira-database-config/jdbc-datasource/password/text()" ${DB_FILE})"
|
||||||
DB_HOST="$(echo $DB_URL|sed 's@^.*//@@;s@\(^.*\):\(.*\)/\(.*\)$@\1@')"
|
DB_HOST="$(echo $DB_URL|sed 's@^.*//@@;s@\(^.*\):\(.*\)/\(.*\)$@\1@')"
|
||||||
DB_PORT="$(echo $DB_URL|sed 's@^.*//@@;s@\(^.*\):\(.*\)/\(.*\)$@\2@')"
|
DB_PORT="$(echo $DB_URL|sed 's@^.*//@@;s@\(^.*\):\(.*\)/\(.*\)$@\2@')"
|
||||||
DB_NAME="$(echo $DB_URL|sed 's@^.*//@@;s@\(^.*\):\(.*\)/\(.*\)$@\3@')"
|
DB_NAME="$(echo $DB_URL|sed 's@^.*//@@;s@\(^.*\):\(.*\)/\(.*\)$@\3@')"
|
||||||
|
@ -1147,9 +1150,12 @@ function getdbcreds_cnf () {
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
DB_URL="$(grep -oPm1 "(?<=<property name=\"hibernate.connection.url\">)[^<]+" ${DB_FILE})"
|
# DB_URL="$(grep -oPm1 "(?<=<property name=\"hibernate.connection.url\">)[^<]+" ${DB_FILE})"
|
||||||
DB_USER="$(grep -oPm1 "(?<=<property name=\"hibernate.connection.username\">)[^<]+" ${DB_FILE})"
|
# DB_USER="$(grep -oPm1 "(?<=<property name=\"hibernate.connection.username\">)[^<]+" ${DB_FILE})"
|
||||||
DB_PWD="$(grep -oPm1 "(?<=<property name=\"hibernate.connection.password\">)[^<]+" ${DB_FILE})"
|
# DB_PWD="$(grep -oPm1 "(?<=<property name=\"hibernate.connection.password\">)[^<]+" ${DB_FILE})"
|
||||||
|
DB_URL="$(xmllint --xpath "confluence-configuration/properties/property[@name='hibernate.connection.url']/text()" ${DB_FILE})"
|
||||||
|
DB_USER="$(xmllint --xpath "confluence-configuration/properties/property[@name='hibernate.connection.username']/text()" ${DB_FILE})"
|
||||||
|
DB_PWD="$(xmllint --xpath "confluence-configuration/properties/property[@name='hibernate.connection.password']/text()" ${DB_FILE})"
|
||||||
DB_HOST="$(echo $DB_URL|sed 's@^.*//@@;s@\(^.*\):\(.*\)/\(.*\)$@\1@')"
|
DB_HOST="$(echo $DB_URL|sed 's@^.*//@@;s@\(^.*\):\(.*\)/\(.*\)$@\1@')"
|
||||||
DB_PORT="$(echo $DB_URL|sed 's@^.*//@@;s@\(^.*\):\(.*\)/\(.*\)$@\2@')"
|
DB_PORT="$(echo $DB_URL|sed 's@^.*//@@;s@\(^.*\):\(.*\)/\(.*\)$@\2@')"
|
||||||
DB_NAME="$(echo $DB_URL|sed 's@^.*//@@;s@\(^.*\):\(.*\)/\(.*\)$@\3@')"
|
DB_NAME="$(echo $DB_URL|sed 's@^.*//@@;s@\(^.*\):\(.*\)/\(.*\)$@\3@')"
|
||||||
|
@ -1206,4 +1212,15 @@ urldecode() {
|
||||||
findlocallogins() {
|
findlocallogins() {
|
||||||
last -F -a $(for i in $(find /var/log -maxdepth 1 -name "wtmp*"|sort -h);do echo -n "-f $i ";done)|grep -v "pts/\|reboot\|wtmp"|awk '{print $4,$5,$7}'|uniq
|
last -F -a $(for i in $(find /var/log -maxdepth 1 -name "wtmp*"|sort -h);do echo -n "-f $i ";done)|grep -v "pts/\|reboot\|wtmp"|awk '{print $4,$5,$7}'|uniq
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gojrahome() {
|
||||||
|
local APP_INST=/opt/atlassian/jira
|
||||||
|
cd $(awk -F "=" '/jira.home/ {gsub(/ /, "", $0); print $2}' "${APP_INST}/atlassian-jira/WEB-INF/classes/jira-application.properties")
|
||||||
|
}
|
||||||
|
|
||||||
|
gojrashome() {
|
||||||
|
local APP_INST=/opt/atlassian/jira
|
||||||
|
local JIRA_HOME=$(awk -F "=" '/jira.home/ {gsub(/ /, "", $0); print $2}' "${APP_INST}/atlassian-jira/WEB-INF/classes/jira-application.properties")
|
||||||
|
[ -e "${JIRA_HOME}/cluster.properties" ] && cd $(awk -F "=" '/jira.shared.home/ {gsub(/ /, "", $0); print $2}' "${JIRA_HOME}/cluster.properties") || echo no shared home configured >&2
|
||||||
|
}
|
||||||
#EOF
|
#EOF
|
||||||
|
|
Loading…
Reference in a new issue