Merge branch 'master' of git.schuerz.at:public/myshellconfig
This commit is contained in:
commit
c26ef455c4
2 changed files with 102 additions and 0 deletions
|
@ -1,3 +1,4 @@
|
||||||
|
<<<<<<< HEAD
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
function help() {
|
function help() {
|
||||||
|
|
101
functions.sh
101
functions.sh
|
@ -1082,6 +1082,7 @@ getusedip () {
|
||||||
}
|
}
|
||||||
|
|
||||||
function getdbcreds_jra () {
|
function getdbcreds_jra () {
|
||||||
|
<<<<<<< HEAD
|
||||||
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"
|
||||||
|
@ -1095,6 +1096,48 @@ function getdbcreds_jra () {
|
||||||
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})"
|
||||||
fi
|
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 "(?<=<url>)[^<]+" ${DB_FILE})"
|
||||||
|
DB_USER="$(grep -oPm1 "(?<=<username>)[^<]+" ${DB_FILE})"
|
||||||
|
DB_PWD="$(grep -oPm1 "(?<=<password>)[^<]+" ${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 "(?<=<url>)[^<]+" ${DB_FILE})"
|
||||||
|
#DB_USER="$(grep -oPm1 "(?<=<username>)[^<]+" ${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})"
|
||||||
|
>>>>>>> ec99f40ff41338646804e8b105b1d4ad7799a6db
|
||||||
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@')"
|
||||||
|
@ -1103,6 +1146,7 @@ function getdbcreds_jra () {
|
||||||
}
|
}
|
||||||
|
|
||||||
function getdbcreds_cnf () {
|
function getdbcreds_cnf () {
|
||||||
|
<<<<<<< HEAD
|
||||||
local APP_INST=/opt/atlassian/confluence
|
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 "=" '/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"
|
||||||
|
@ -1116,6 +1160,48 @@ function getdbcreds_cnf () {
|
||||||
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})"
|
||||||
fi
|
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 "(?<=<property name=\"hibernate.connection.url\">)[^<]+" ${DB_FILE})"
|
||||||
|
DB_USER="$(grep -oPm1 "(?<=<property name=\"hibernate.connection.username\">)[^<]+" ${DB_FILE})"
|
||||||
|
DB_PWD="$(grep -oPm1 "(?<=<property name=\"hibernate.connection.password\">)[^<]+" ${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 "(?<=<property name=\"hibernate.connection.url\">)[^<]+" ${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_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_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@')"
|
||||||
|
@ -1174,6 +1260,7 @@ 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
|
||||||
}
|
}
|
||||||
|
<<<<<<< HEAD
|
||||||
|
|
||||||
getjrahomes() {
|
getjrahomes() {
|
||||||
local APP_INST=/opt/atlassian/jira
|
local APP_INST=/opt/atlassian/jira
|
||||||
|
@ -1252,5 +1339,19 @@ gocnfshome() {
|
||||||
cd "${APP_SHARED_HOME}"
|
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
|
#EOF
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue