make connectdb related to hostname

This commit is contained in:
Jakobus Schürz 2022-07-26 18:17:45 +02:00
parent d64ad537ca
commit 5ea462f314

View file

@ -1104,7 +1104,7 @@ function getdbcreds_jra () {
function getdbcreds_cnf () {
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 CNF_HOME=$(awk -F "=" '/confluence.home/ {gsub(/ /, "", $0); print $2}' "${APP_INST}/confluence/WEB-INF/classes/confluence-init.properties")
local DB_FILE="${CNF_HOME}/confluence.cfg.xml"
if xmllint --version >/dev/null 2>&1; then
DB_URL="$(xmllint --xpath "confluence-configuration/properties/property[@name='hibernate.connection.url']/text()" ${DB_FILE})"
@ -1127,13 +1127,20 @@ function getdbcreds_cnf () {
function connectdb () {
case $1 in
jra|jira)
case $HOSTNAME in
*jra*|*jira*)
getdbcreds_jra $2
;;
cnf|conf|confluence)
*cnf*|*confapp*)
getdbcreds_cnf $2
;;
# case $1 in
# jra|jira)
# getdbcreds_jra $2
# ;;
# cnf|conf|confluence)
# getdbcreds_cnf $2
# ;;
*)
echo "wrong argument"
return 1