You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
84 lines
2.5 KiB
84 lines
2.5 KiB
#!/bin/bash |
|
|
|
#BI Update 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:ULR in Kleinbuchstaben, z.B.: |
|
#export BI_UPDATE_MODULES="sos:trans_pruefungen_1_sospos sos:trans_pruefungen_2 sos:trans_pruefungen_3 sos gang" |
|
#LOGPFAD=/var/log/tomcat9 |
|
#Mailprogramm: |
|
#export MAILPROG=s-nail |
|
|
|
|
|
#Beispielaufruf: |
|
#export BI_UPDATE_MODULES="sos gang" |
|
|
|
# |
|
#Variablen und Umgebung setzen: |
|
|
|
MASTERLOG=$LOGPFAD/bi_update.log |
|
|
|
#erzeuge Logs Verzeichnis wenn es noch nicht existiert: |
|
mkdir -p $LOGPFAD |
|
|
|
echo "Start BI-Jobs $BI_UPDATE_MODULES" >$MASTERLOG |
|
date >>$MASTERLOG |
|
|
|
ERROR_FLAG=0 |
|
ERROR_LOG="" |
|
|
|
executeUpdate() |
|
{ |
|
JOB=$1 |
|
LOGPFAD=$2 |
|
MYMASTERLOG=$3 |
|
MODUL=$JOB |
|
MODUL_UPPER=`echo $MODUL | tr [a-z] [A-Z]` |
|
JOBLOG=$LOGPFAD/"$JOB"_update.log |
|
echo "Start JOB $JOB " >>$MYMASTERLOG |
|
date >>$MYMASTERLOG |
|
echo java -Xmx${MEM} -cp "...CLASSPATH" -Dfile.encoding=UTF-8 de.his.edustore.modules.WebFrontendForModuleUpdate $JOB true '$SUPERX_DIR='$WEBAPP'/WEB-INF/conf/edustore $'$MODUL_UPPER'_LOAD_PFAD='$WEBAPP'/WEB-INF/conf/edustore/db/module/'$MODUL'/rohdaten $'$MODUL_UPPER'_PFAD='$WEBAPP'/WEB-INF/conf/edustore/db/module/'$MODUL >>$JOBLOG 2>&1 |
|
java -Xmx${MEM} -cp "$QIS_CLASSPATH" -Dfile.encoding=UTF-8 de.his.edustore.modules.WebFrontendForModuleUpdate $JOB true '$SUPERX_DIR='$WEBAPP'/WEB-INF/conf/edustore $'$MODUL_UPPER'_LOAD_PFAD='$WEBAPP'/WEB-INF/conf/edustore/db/module/'$MODUL'/rohdaten $'$MODUL_UPPER'_PFAD='$WEBAPP'/WEB-INF/conf/edustore/db/module/'$MODUL >>$JOBLOG 2>&1 |
|
|
|
RETURN_CODE=$? |
|
echo "End Job $JOB with RETURN_CODE $RETURN_CODE" >>$MYMASTERLOG |
|
date >>$MYMASTERLOG |
|
if [ $RETURN_CODE -eq 0 ] |
|
then |
|
echo "End Job $JOB erfolgreich" >>$MYMASTERLOG |
|
else |
|
echo "Job $JOB Fehler" >> $MYMASTERLOG |
|
ERROR_FLAG=1 |
|
ERROR_LOG+=" -a $JOBLOG" |
|
fi |
|
} |
|
|
|
#Updates: |
|
|
|
echo -e "######################################\n\n" >>$MASTERLOG |
|
for JOB_SINGLE in ${BI_UPDATE_MODULES[@]} ; do |
|
echo "start bi_"$JOB_SINGLE"_update `date`" >>$MASTERLOG |
|
executeUpdate $JOB_SINGLE $LOGPFAD $MASTERLOG |
|
echo "ende bi_"$JOB_SINGLE"_update `date`" >>$MASTERLOG |
|
done |
|
echo -e "\n\n######################################" >>$MASTERLOG |
|
echo -e "-- Ende BI update `date`\n\n" >>$MASTERLOG |
|
|
|
|
|
if [ $ERROR_FLAG -eq 0 ] |
|
then |
|
if [ "$MAILPROG" != "" ] |
|
then |
|
$MAILPROG -s "BI Job $JOB Erfolgreich" $LOGMAIL <$MYMASTERLOG |
|
fi |
|
|
|
else |
|
if [ "$MAILPROG" != "" ] |
|
then |
|
echo "sending logmail to $LOGMAIL" |
|
$MAILPROG -s "BI Job $JOB Fehler" $ERROR_LOG $LOGMAIL <$MYMASTERLOG |
|
fi |
|
|
|
fi
|
|
|