fix function to get ips and hostnames from net
This commit is contained in:
parent
c766602cc3
commit
53bdc127e8
1 changed files with 22 additions and 4 deletions
26
functions.sh
26
functions.sh
|
@ -1104,7 +1104,7 @@ getfreeip () {
|
||||||
|
|
||||||
local N=$1
|
local N=$1
|
||||||
|
|
||||||
sudo nmap -v -sn -n $1 -oG - | awk '/Status: Down/{print $2}'
|
nmap -v -sn -n ${N} -oG - | awk '/Status: Down/{print $2}'
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1113,13 +1113,31 @@ getusedip () {
|
||||||
local N=$1
|
local N=$1
|
||||||
local DNS=$2
|
local DNS=$2
|
||||||
|
|
||||||
sudo nmap -v -sn -n $1 -oG - | awk '!/Status: Down/{print $2}'|while read i;do
|
nmap -v -sn -n $1 -oG - | awk '!/Status: Down/{print $2}'|while read i;do
|
||||||
echo "$i: $(dig "${DNS:+@}${DNS}" -x $i +short +search)"
|
echo "$i: $(dig ${DNS:+@}${DNS:-} -x $i +short +search)"
|
||||||
|
|
||||||
done
|
done
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getips () {
|
||||||
|
|
||||||
|
local N=$1
|
||||||
|
local DNS=$2
|
||||||
|
|
||||||
|
nmap -v -sn -n $1 -oG - | while read i
|
||||||
|
do
|
||||||
|
j=$(echo "$i"|awk '{print $2}')
|
||||||
|
case $i in
|
||||||
|
*Status:\ Down*)
|
||||||
|
echo "$j: $(dig ${DNS:+@}${DNS:-} -x $j +short +search)"
|
||||||
|
;;
|
||||||
|
*Status:\ Up*)
|
||||||
|
echo "$j:"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
function getdbcreds_jra () {
|
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")
|
||||||
|
|
Loading…
Reference in a new issue