Compare commits

..

2 commits

Author SHA1 Message Date
Jakobus Schürz
74a9180dc6 fix goarchive 2024-04-17 16:26:29 +02:00
Jakobus Schürz
53bdc127e8 fix function to get ips and hostnames from net 2024-04-17 16:26:29 +02:00

View file

@ -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")
@ -1411,8 +1429,9 @@ EOF
} }
function goarchive () { function goarchive () {
local SHOPTEXTGLOB="$(shopt -p |grep extglob)"
shopt -s extglob shopt -s extglob
if [ "{#:-0}" -gt 0 ] if [ "${#:-0}" -gt 0 ]
then then
case "$1" in case "$1" in
-h) -h)
@ -1444,23 +1463,8 @@ EOF
else else
[ -e "$(xdg-user-dir ARCHIVE)" ] && cd "$(xdg-user-dir ARCHIVE)" [ -e "$(xdg-user-dir ARCHIVE)" ] && cd "$(xdg-user-dir ARCHIVE)"
fi fi
shopt -u extglob # shopt -u extglob
} eval $SHOPTEXTGLOB
checkkernel () {
for i in /vmlinuz /boot/vmlinuz
do
[ -e "${i}" ] || continue
if [ $(basename $(readlink -f "${i}")) = vmlinuz-$(uname -r) ]
then
printf "%s\n" "Kein Upgrade notwendig. Kernel aktuell"
else
printf "%s\n" "Reboot notwendig!!"
res=1
fi
return ${res:-0}
done
} }
#EOF #EOF