Browse Source

Umgebung und Script für Modulupgrades #1

master
Daniel Quathamer 2 years ago
parent
commit
2bc884fa8b
  1. 16
      .gitignore
  2. 25
      env/BI_ENV.sam
  3. 6
      excludes.txt.sam
  4. 2
      includes.txt.sam
  5. 82
      upgrade/hisinone_bi_qisserver/modules_upgrade.sh

16
.gitignore vendored

@ -0,0 +1,16 @@
# ignore
# vim .swp files
*.swp
**/log/
**/BI_ENV
# Use wildcards as well
*~
*ENV
*tmp*
*.log
*.log.*
*.err
*.class
*.zip
*.tar*
*.tgz

25
env/BI_ENV.sam vendored

@ -0,0 +1,25 @@
#!/bin/bash
#BI Environment (Muster für Tomcat9 unter Ubuntu)
WEBAPP=/var/lib/tomcat9/webapps/superx
export WEBAPP
#Module Liste:
#Hier werden die zu verwendende Module aufgelistet.
#Nur den Modulnamen in Kleinbuchstaben
#export BI_INSTALLED_MODULES_ITEMS="kern cob sos sva kenn"
LOGPFAD=/var/log/tomcat9
export LOGPFAD
#Mailprogramm:
export MAILPROG=s-nail
#RAM für Java:
MEM=2000M
export MEM
#Speziell für HISinOne-BI:
QISSERVER_PFAD=$WEBAPP/../qisserver
QISSERVER_LIB_PFAD=$QISSERVER_PFAD/WEB-INF/lib
QIS_CLASSPATH="$TOMCAT_PATH/lib/servlet-api.jar:$QISSERVER_PFAD/WEB-INF/classes" ; for i in `ls $QISSERVER_LIB_PFAD/*.jar` ; do QIS_CLASSPATH=$QIS_CLASSPATH:$i ; done
export QIS_CLASSPATH

6
excludes.txt.sam

@ -1,6 +0,0 @@
#files or directories to be excluded:
.*
excludes*
includes*
rsync_to_h1.x

2
includes.txt.sam

@ -1,2 +0,0 @@
#Dateiliste
README.txt.sam

82
upgrade/hisinone_bi_qisserver/modules_upgrade.sh

@ -0,0 +1,82 @@
#!/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_INSTALLED_MODULES_ITEMS="kern cob sos sva kenn"
#LOGPFAD=/var/log/tomcat9
#Mailprogramm:
#export MAILPROG=mail
#Beispielaufruf:
#export BI_INSTALLED_MODULES_ITEMS="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:
separator=":"
if [[ "$(uname)" == MINGW* ]]; then
separator=";" # on windows java uses the ; separator
fi
MASTERLOG=$LOGPFAD/bi_upgrade.log
#erzeuge Logs Verzeichnis wenn es noch nicht existiert:
mkdir -p $LOGPFAD
echo "Start BI-Upgrades " >$MASTERLOG
date >>$MASTERLOG
#
cd $WEBAPP
java -Xmx${MEM} -cp "$QIS_CLASSPATH" -Dfile.encoding=UTF-8 de.his.edustore.modules.WebFrontendForModuleInstall kern upgrade '$SUPERX_DIR=/disk1/webapps/superx/WEB-INF/conf/edustore'
executeUpgrade()
{
MODUL=$1
LOGPFAD=$2
MYMASTERLOG=$3
MODUL_UPPER=`echo $MODUL | tr [a-z] [A-Z]`
MODULLOG=$LOGPFAD/"$MODUL_UPPER"_upgrade.log
echo "Start MODUL $MODUL_UPPER " >>$MYMASTERLOG
date >>$MYMASTERLOG
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/sos'
RETURN_CODE=$?
echo "End Upgrade $MODUL " >>$MYMASTERLOG
date >>$MYMASTERLOG
if [ $RETURN_CODE -eq 0 -a "$MAILPROG" != "" ]
then
echo "End MODUL $MODUL erfolgreich" >>$MYMASTERLOG
$MAILPROG -s "MODUL $MODUL_UPPER ok" $LOGMAIL <$MYMASTERLOG
else
echo "MODUL $MODUL_UPPER Fehler" >> $MYMASTERLOG
echo "sending logmail to $LOGMAIL"
$MAILPROG -s "BI MODUL $MODUL_UPPER Fehler" -a $MODULLOG $LOGMAIL <$MYMASTERLOG
exit 3
fi
}
#Upgrades:
echo -e "######################################\n\n" >>$MASTERLOG
for MODULE_SINGLE in ${BI_INSTALLED_MODULES_ITEMS[@]} ; do
echo "start bi_"$MODULE_SINGLE"_upgrade `date`" >>$MASTERLOG
executeUpgrade $MODULE_SINGLE $LOGPFAD $MASTERLOG
echo "ende bi_"$MODULE_SINGLE"_upgrade `date`" >>$MASTERLOG
done
echo -e "\n\n######################################" >>$MASTERLOG
echo -e "-- Ende BI upgrade `date`\n\n" >>$MASTERLOG
Loading…
Cancel
Save