diff --git a/bin/haproxy-maintenance b/bin/haproxy-maintenance index bc40ace..74083ab 100755 --- a/bin/haproxy-maintenance +++ b/bin/haproxy-maintenance @@ -1,3 +1,4 @@ +<<<<<<< HEAD #!/bin/bash function help() { diff --git a/functions.sh b/functions.sh index ff05bb9..f284743 100755 --- a/functions.sh +++ b/functions.sh @@ -1082,6 +1082,7 @@ getusedip () { } function getdbcreds_jra () { +<<<<<<< HEAD local APP_INST=/opt/atlassian/jira local JRA_HOME=$(awk -F "=" '/jira.home/ {gsub(/ /, "", $0); print $2}' "${APP_INST}/atlassian-jira/WEB-INF/classes/jira-application.properties") local DB_FILE="${JRA_HOME}/dbconfig.xml" @@ -1095,6 +1096,48 @@ function getdbcreds_jra () { DB_USER="$(grep -oPm1 "(?<=)[^<]+" ${DB_FILE})" DB_PWD="$(grep -oPm1 "(?<=)[^<]+" ${DB_FILE})" fi +||||||| ea90fa6 + case $# in + 0) + gojirahome + DB_FILE=dbconfig.xml + #cd - + ;; + 1) + DB_FILE=$1 + ;; + *) + echo "wrong number of arguments" + return 1 + ;; + esac + + DB_URL="$(grep -oPm1 "(?<=)[^<]+" ${DB_FILE})" + DB_USER="$(grep -oPm1 "(?<=)[^<]+" ${DB_FILE})" + DB_PWD="$(grep -oPm1 "(?<=)[^<]+" ${DB_FILE})" +======= + case $# in + 0) + gojirahome + DB_FILE=dbconfig.xml + #cd - + ;; + 1) + DB_FILE=$1 + ;; + *) + echo "wrong number of arguments" + return 1 + ;; + esac + + #DB_URL="$(grep -oPm1 "(?<=)[^<]+" ${DB_FILE})" + #DB_USER="$(grep -oPm1 "(?<=)[^<]+" ${DB_FILE})" + #DB_PWD="$(grep -oPm1 "(?<=)[^<]+" ${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})" +>>>>>>> ec99f40ff41338646804e8b105b1d4ad7799a6db DB_HOST="$(echo $DB_URL|sed 's@^.*//@@;s@\(^.*\):\(.*\)/\(.*\)$@\1@')" DB_PORT="$(echo $DB_URL|sed 's@^.*//@@;s@\(^.*\):\(.*\)/\(.*\)$@\2@')" DB_NAME="$(echo $DB_URL|sed 's@^.*//@@;s@\(^.*\):\(.*\)/\(.*\)$@\3@')" @@ -1103,6 +1146,7 @@ function getdbcreds_jra () { } function getdbcreds_cnf () { +<<<<<<< HEAD local APP_INST=/opt/atlassian/confluence local CNF_HOME=$(awk -F "=" '/jira.home/ {gsub(/ /, "", $0); print $2}' "${APP_INST}/confluence/WEB-INF/classes/confluence-init.properties") local DB_FILE="${CNF_HOME}/confluence.cfg.xml" @@ -1116,6 +1160,48 @@ function getdbcreds_cnf () { DB_USER="$(grep -oPm1 "(?<=)[^<]+" ${DB_FILE})" DB_PWD="$(grep -oPm1 "(?<=)[^<]+" ${DB_FILE})" fi +||||||| ea90fa6 + case $# in + 0) + gocnfhome + DB_FILE=confluence.cfg.xml + ;; + 1) + DB_FILE=$1 + ;; + *) + echo "wrong number of arguments" + cd - + return 1 + ;; + esac + + DB_URL="$(grep -oPm1 "(?<=)[^<]+" ${DB_FILE})" + DB_USER="$(grep -oPm1 "(?<=)[^<]+" ${DB_FILE})" + DB_PWD="$(grep -oPm1 "(?<=)[^<]+" ${DB_FILE})" +======= + case $# in + 0) + gocnfhome + DB_FILE=confluence.cfg.xml + ;; + 1) + DB_FILE=$1 + ;; + *) + echo "wrong number of arguments" + cd - + return 1 + ;; + esac + +# DB_URL="$(grep -oPm1 "(?<=)[^<]+" ${DB_FILE})" +# DB_USER="$(grep -oPm1 "(?<=)[^<]+" ${DB_FILE})" +# DB_PWD="$(grep -oPm1 "(?<=)[^<]+" ${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})" +>>>>>>> ec99f40ff41338646804e8b105b1d4ad7799a6db DB_HOST="$(echo $DB_URL|sed 's@^.*//@@;s@\(^.*\):\(.*\)/\(.*\)$@\1@')" DB_PORT="$(echo $DB_URL|sed 's@^.*//@@;s@\(^.*\):\(.*\)/\(.*\)$@\2@')" DB_NAME="$(echo $DB_URL|sed 's@^.*//@@;s@\(^.*\):\(.*\)/\(.*\)$@\3@')" @@ -1174,6 +1260,7 @@ urldecode() { 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 } +<<<<<<< HEAD getjrahomes() { local APP_INST=/opt/atlassian/jira @@ -1252,5 +1339,19 @@ gocnfshome() { cd "${APP_SHARED_HOME}" } +||||||| ea90fa6 +======= + +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 +} +>>>>>>> ec99f40ff41338646804e8b105b1d4ad7799a6db #EOF