Daniel Quathamer
2 years ago
3 changed files with 101 additions and 9 deletions
@ -0,0 +1,81 @@ |
|||||||
|
#!/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_JOBS_ITEMS="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_JOBS_ITEMS="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 " >$MASTERLOG |
||||||
|
date >>$MASTERLOG |
||||||
|
|
||||||
|
# |
||||||
|
|
||||||
|
|
||||||
|
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 |
||||||
|
if [ "$MAILPROG" != "" ] |
||||||
|
then |
||||||
|
$MAILPROG -s "Job $JOB ok" $LOGMAIL <$MYMASTERLOG |
||||||
|
fi |
||||||
|
|
||||||
|
else |
||||||
|
echo "Job $JOB Fehler" >> $MYMASTERLOG |
||||||
|
if [ "$MAILPROG" != "" ] |
||||||
|
then |
||||||
|
echo "sending logmail to $LOGMAIL" |
||||||
|
$MAILPROG -s "BI Job $JOB Fehler" -a $JOBLOG $LOGMAIL <$MYMASTERLOG |
||||||
|
fi |
||||||
|
|
||||||
|
fi |
||||||
|
} |
||||||
|
|
||||||
|
#Updates: |
||||||
|
|
||||||
|
echo -e "######################################\n\n" >>$MASTERLOG |
||||||
|
for JOB_SINGLE in ${BI_JOBS_ITEMS[@]} ; 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 |
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,10 @@ |
|||||||
|
#!/bin/bash |
||||||
|
#Bitte umbenennen nach modules_update_cron.sh |
||||||
|
#Und den Pfad /var/lib/tomcat9... anpassen: |
||||||
|
#in crontab: |
||||||
|
# Werktäglicher BI-Update um 18 Uhr |
||||||
|
#0 18 * * 1-5 /var/lib/tomcat9/BI_Maintenance/update/modules_update_cron.sh >/var/lib/tomcat9/BI_Maintenance/update/hisinone_bi_qisserver/modules_update.log 2>&1 |
||||||
|
. /var/lib/tomcat9/BI_Maintenance/env/BI_ENV |
||||||
|
#bei Nutzung H1-Qisserver: |
||||||
|
#/var/lib/tomcat9/BI_Maintenance/update/hisinone_bi_qisserver/modules_update.sh >/var/lib/tomcat9/BI_Maintenance/update/hisinone_bi_qisserver/modules_update.log 2>&1 |
||||||
|
|
Loading…
Reference in new issue