Good midday and hello to everyone! =)
If I describe some things wrong please be aware, that english is not my native language!!
I'm a bit stuck with a script I need to finish. Due to data protection I need to hide some paths but that should be no problem.
My script connects to a db2 database and pulls the information of "app_name" and "app_version". It then compares the two parameters with a directory. If some of the names and versions do not match or can't be found it needs to check if the untraceable data can be found in another file. The format I pull out of the database is like this: AAL;00.01-02; first the "app_name" and second the "app_version"
This is the part where I am stuck. Maybe i'm just to tired or I think way to complicated but I can't find a solution
function readdatabase() {
test -f /opt/XXXX/tc/conf/TC.conninfo || ftc_die "Datei nicht gefunden --> Abbruch"
ftc_info "TC.conninfo einlesen"
. /opt/XXXX/tc/conf/TC.conninfo && ftc_ok "Datei vorhanden --> Einlesen"
ftc_info "Verbinde mit DB2 Datenbank"
db2 connect to $CONN_DB user $CONN_USER using $CONN_PW || ftc_die "DB-Connect fehlgeschlagen"
ftc_ok "DB-Connect erfolgreich"
ftc_info "Hole app_name und app_version aus DB"
db2 -x "select distinct trim(lower(app_name_ga)) || ';' || trim(app_version_ga) from tanc_gavR4" | \
#sed -e 's|/modules_|;|;s|.properties||' > $FTC_TMPDIR/tanc_gav.tmp
sed -e " /^$/ d" \
> $FTC_TMPDIR/tanc_gav.tmp
cd /opt/tomcat_xxx_1/webapps/xxx/app && \
ls -d */modules_* | \
sed -e 's|/modules_|;|;s|.properties||' > $FTC_TMPDIR/directory.tmp
while read -r ZEILE ; do
APP=${ZEILE/;*}
VER=${ZEILE/*;}
test -f /opt/tomcat_xxx_1/webapps/xxx/app/$APP/modules_$VER.properties || ftc_warning "$APP;$VER fehlt"
# cat /var/servershare/scripts/templates/webanwendungen.dbin | sed -e 's|/modules_|;|;s|.properties||'
done < $FTC_TMPDIR/tanc_gav.tmp
}
So my idea was to use a while if else statement and compare the modules that can't be find with the "webanwendungen.dbin" but I don't know how to do that.
If you need further information please let me know.
Thank you in advance!