|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
#BI Upgrade Script (Muster, siehe ../../env/BI_ENV.sam)
|
|
|
|
#Benutzte Variablen:
|
|
|
|
#WEBAPP=/var/lib/tomcat9/webapps/superx
|
|
|
|
#Module Liste:
|
|
|
|
#Hier werden die zu verwendende Module aufgelistet.
|
|
|
|
#Nur den Modulnamen in Kleinbuchstaben
|
|
|
|
#export BI_UPGRADE_MODULES="kern cob sos sva kenn"
|
|
|
|
#LOGPFAD=/var/log/tomcat9
|
|
|
|
#Mailprogramm:
|
|
|
|
#export MAILPROG=s-nail
|
|
|
|
|
|
|
|
|
|
|
|
#Beispielaufruf:
|
|
|
|
#export BI_UPGRADE_MODULES="erfolg kenn"
|
|
|
|
#modules_upgrade.sh
|
|
|
|
#in crontab:
|
|
|
|
# Werktäglicher BI-Upgrade um 18 Uhr
|
|
|
|
#0 18 * * 1-5 /var/lib/tomcat9/BI_Maintenance/upgrade/hisinone_bi_qisserver/modules_upgrade.sh >/var/lib/tomcat9/BI_Maintenance/upgrade/hisinone_bi_qisserver/modules_upgrade.log 2>&1
|
|
|
|
|
|
|
|
#
|
|
|
|
#Variablen und Umgebung setzen:
|
|
|
|
|
|
|
|
MASTERLOG=$LOGPFAD/bi_upgrade.log
|
|
|
|
|
|
|
|
#erzeuge Logs Verzeichnis wenn es noch nicht existiert:
|
|
|
|
mkdir -p $LOGPFAD
|
|
|
|
|
|
|
|
ERROR_FLAG=0
|
|
|
|
ERROR_LOG=""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
|
|
executeUpgrade()
|
|
|
|
{
|
|
|
|
MODUL=$1
|
|
|
|
LOGPFAD=$2
|
|
|
|
MYMASTERLOG=$3
|
|
|
|
MODUL_UPPER=`echo $MODUL | tr [a-z] [A-Z]`
|
|
|
|
MODULLOG=$LOGPFAD/"$MODUL_UPPER"_upgrade.log
|
|
|
|
echo "--- Start Upgrade für: $MODUL_UPPER ---" >>$MYMASTERLOG
|
|
|
|
date >>$MYMASTERLOG
|
|
|
|
echo Executing java -Xmx${MEM} -cp "...QIS_CLASSPATH" -Dfile.encoding=UTF-8 de.his.edustore.modules.WebFrontendForModuleInstall $MODUL upgrade '$SUPERX_DIR='$WEBAPP'/WEB-INF/conf/edustore $'$MODUL_UPPER'_PFAD='$WEBAPP'/WEB-INF/conf/edustore/db/module/'$MODUL >>$MODULLOG 2>&1
|
|
|
|
java -Xmx${MEM} -cp "$QIS_CLASSPATH" -Dfile.encoding=UTF-8 de.his.edustore.modules.WebFrontendForModuleInstall $MODUL upgrade '$SUPERX_DIR='$WEBAPP'/WEB-INF/conf/edustore $'$MODUL_UPPER'_PFAD='$WEBAPP'/WEB-INF/conf/edustore/db/module/'$MODUL >>$MODULLOG 2>&1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
RETURN_CODE=$?
|
|
|
|
echo "Returncode von dem Job des Moduls $MODUL_UPPER ist: $RETURN_CODE" >>$MYMASTERLOG
|
|
|
|
date >>$MYMASTERLOG
|
|
|
|
if [ $RETURN_CODE -eq 0 ]
|
|
|
|
then
|
|
|
|
echo "--- Ende Upgrade von $MODUL_UPPER: erfolgreich ---" >>$MYMASTERLOG
|
|
|
|
else
|
|
|
|
echo ">>>> Achtung: Das Update des Modules $MODUL_UPPER wurde mit einem Fehler beendet! <<<<" >> $MYMASTERLOG
|
|
|
|
echo "--- Ende des Upgrades vom Modul $MODUL_UPPER mit Fehler ---" >>$MYMASTERLOG
|
|
|
|
ERROR_FLAG=1
|
|
|
|
fi
|
|
|
|
ERROR_LOG+=" $MAIL_APPEND $JOBLOG"
|
|
|
|
echo "" >>$MYMASTERLOG
|
|
|
|
}
|
|
|
|
|
|
|
|
#Upgrades:
|
|
|
|
|
|
|
|
echo "Starte BI-Upgrades für die Module: $BI_UPGRADE_MODULES" >$MASTERLOG
|
|
|
|
date >>$MASTERLOG
|
|
|
|
echo -e "######################################\n\n" >>$MASTERLOG
|
|
|
|
for MODULE_SINGLE in ${BI_UPGRADE_MODULES[@]} ; do
|
|
|
|
executeUpgrade $MODULE_SINGLE $LOGPFAD $MASTERLOG
|
|
|
|
done
|
|
|
|
echo -e "\n\n######################################" >>$MASTERLOG
|
|
|
|
echo -e "-- Ende BI upgrade `date`\n\n" >>$MASTERLOG
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Mailversand
|
|
|
|
if [ $ERROR_FLAG -eq 0 ]
|
|
|
|
then
|
|
|
|
if [ "$MAILPROG" != "" ]
|
|
|
|
then
|
|
|
|
$MAILPROG -s "$MAIL_BETREFF_UPGRADE$MAIL_BETREFF_SUFFIX_ERFOLGREICH" $LOGMAIL <$MYMASTERLOG
|
|
|
|
fi
|
|
|
|
|
|
|
|
else
|
|
|
|
if [ "$MAILPROG" != "" ]
|
|
|
|
then
|
|
|
|
echo "Sende Logmail an $LOGMAIL"
|
|
|
|
$MAILPROG -s "$MAIL_BETREFF_UPGRADE$MAIL_BETREFF_SUFFIX_FEHLER" $ERROR_LOG $LOGMAIL <$MYMASTERLOG
|
|
|
|
fi
|
|
|
|
|
|
|
|
fi
|
|
|
|
|