change add functions for atlassians
This commit is contained in:
parent
1c9dc9a937
commit
9683283e73
1 changed files with 77 additions and 9 deletions
86
functions.sh
86
functions.sh
|
@ -1085,7 +1085,7 @@ function getdbcreds_jra () {
|
||||||
local APP_INST=/opt/atlassian/jira
|
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 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"
|
local DB_FILE="${JRA_HOME}/dbconfig.xml"
|
||||||
if [ xmllint --version >/dev/null 2>&1 ]; then
|
if xmllint --version >/dev/null 2>&1; then
|
||||||
DB_URL="$(xmllint --xpath "jira-database-config/jdbc-datasource/url/text()" ${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_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_PWD="$(xmllint --xpath "jira-database-config/jdbc-datasource/password/text()" ${DB_FILE})"
|
||||||
|
@ -1103,10 +1103,10 @@ function getdbcreds_jra () {
|
||||||
}
|
}
|
||||||
|
|
||||||
function getdbcreds_cnf () {
|
function getdbcreds_cnf () {
|
||||||
local APP_INST=/opt/atlassian/jira
|
local APP_INST=/opt/atlassian/confluence
|
||||||
local CNF_HOME=$(awk -F "=" '/jira.home/ {gsub(/ /, "", $0); print $2}' "${APP_INST}/atlassian-jira/WEB-INF/classes/jira-application.properties")
|
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"
|
local DB_FILE="${CNF_HOME}/confluence.cfg.xml"
|
||||||
if [ xmllint --version >/dev/null 2>&1 ]; then
|
if xmllint --version >/dev/null 2>&1; then
|
||||||
DB_URL="$(xmllint --xpath "confluence-configuration/properties/property[@name='hibernate.connection.url']/text()" ${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_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_PWD="$(xmllint --xpath "confluence-configuration/properties/property[@name='hibernate.connection.password']/text()" ${DB_FILE})"
|
||||||
|
@ -1175,14 +1175,82 @@ 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() {
|
getjrahomes() {
|
||||||
local APP_INST=/opt/atlassian/jira
|
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")
|
APP_HOME=$(awk -F "=" '/^jira.home/ {gsub(/ /, "", $0); print $2}' "${APP_INST}/atlassian-jira/WEB-INF/classes/jira-application.properties")
|
||||||
|
[ -e "${APP_HOME}/cluster.properties" ] \
|
||||||
|
&& APP_SHARED_HOME=$(awk -F "=" '/^jira.shared.home/ {gsub(/ /, "", $0); print $2}' "${APP_HOME}/cluster.properties")
|
||||||
|
}
|
||||||
|
|
||||||
|
getcnfhomes() {
|
||||||
|
xmllint --version >/dev/null 2>&1 || { echo "please install xmllint »apt install libxml2-utils«" >&2; return 1; }
|
||||||
|
local APP_INST=/opt/atlassian/confluence
|
||||||
|
APP_HOME="$(awk -F "=" '/^confluence.home/ {gsub(/ /, "", $0); print $2}' "${APP_INST}/confluence/WEB-INF/classes/confluence-init.properties" )"
|
||||||
|
[ -e "${APP_HOME}/confluence.cfg.xml" ] \
|
||||||
|
&& APP_SHARED_HOME="$(xmllint --xpath "confluence-configuration/properties/property[@name='confluence.cluster.home']/text()" "${APP_HOME}/confluence.cfg.xml" 2>/dev/null)"
|
||||||
|
}
|
||||||
|
|
||||||
|
getatsvc() {
|
||||||
|
case $HOSTNAME in
|
||||||
|
*jra*|*jira*)
|
||||||
|
export SVC=jra;
|
||||||
|
export APP_NAME=jira
|
||||||
|
export APP_INST_NAME=atlassian-jira
|
||||||
|
export APP_LOG_DIR=log
|
||||||
|
getjrahomes
|
||||||
|
;;
|
||||||
|
*cnf*|*confapp*)
|
||||||
|
export SVC=cnf;
|
||||||
|
export APP_NAME=confluence
|
||||||
|
export APP_INST_NAME=confluence
|
||||||
|
export APP_LOG_DIR=logs
|
||||||
|
getcnfhomes
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
case ${HOSTNAME} in
|
||||||
|
sl[etp]*)
|
||||||
|
export PTE=${HOSTNAME:2:1}
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
goathome() {
|
||||||
|
getatsvc
|
||||||
|
[ "${APP_HOME:-x}" == "x" ] && { echo no $SVC home configured >&2; return 127; }
|
||||||
|
cd "${APP_HOME}"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
goatshome() {
|
||||||
|
getatsvc
|
||||||
|
[ "${APP_SHARED_HOME:-x}" == "x" ] && { echo no $SVC home configured >&2; return 127; }
|
||||||
|
cd "${APP_SHARED_HOME}"
|
||||||
|
}
|
||||||
|
|
||||||
|
gojrahome() {
|
||||||
|
getjrahomes
|
||||||
|
[ "${APP_HOME:-x}" == "x" ] && { echo no jira home configured >&2; return 127; }
|
||||||
|
cd "${APP_HOME}"
|
||||||
}
|
}
|
||||||
|
|
||||||
gojrashome() {
|
gojrashome() {
|
||||||
local APP_INST=/opt/atlassian/jira
|
getjrahomes
|
||||||
local JRA_HOME=$(awk -F "=" '/jira.home/ {gsub(/ /, "", $0); print $2}' "${APP_INST}/atlassian-jira/WEB-INF/classes/jira-application.properties")
|
[ "${APP_SHARED_HOME:-x}" == "x" ] && { echo no jira shared-home configured >&2; return 127; }
|
||||||
[ -e "${JRA_HOME}/cluster.properties" ] && cd $(awk -F "=" '/jira.shared.home/ {gsub(/ /, "", $0); print $2}' "${JRA_HOME}/cluster.properties") || echo no shared home configured >&2
|
cd "${APP_SHARED_HOME}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gocnfhome() {
|
||||||
|
getcnfhomes
|
||||||
|
[ "${APP_HOME:-x}" == "x" ] && { echo no confluence home configured >&2; return 127; }
|
||||||
|
cd "${APP_HOME}"
|
||||||
|
}
|
||||||
|
|
||||||
|
gocnfshome() {
|
||||||
|
getcnfhomes
|
||||||
|
[ "${APP_SHARED_HOME:-x}" == "x" ] && { echo no confluence shared-home configured >&2; return 127; }
|
||||||
|
cd "${APP_SHARED_HOME}"
|
||||||
|
}
|
||||||
|
|
||||||
#EOF
|
#EOF
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue