Skip to content
Snippets Groups Projects
Commit def72cd0 authored by rhaag's avatar rhaag
Browse files

FX-49 cleanup after merge, try to fix javadoc

parent a1ad9dbe
No related branches found
No related tags found
No related merge requests found
Showing
with 29 additions and 1432 deletions
...@@ -54,4 +54,6 @@ syntax: regexp ...@@ -54,4 +54,6 @@ syntax: regexp
syntax: regexp syntax: regexp
^\.project$ ^\.project$
syntax: regexp syntax: regexp
^\.externalToolBuilders$ ^\.externalToolBuilders$
\ No newline at end of file syntax: regexp
^olat\.local\.properties$
\ No newline at end of file
...@@ -78,13 +78,9 @@ localization.cache=false ...@@ -78,13 +78,9 @@ localization.cache=false
user.generateTestUsers=false user.generateTestUsers=false
# When running in eclipse use "INFO, syslog, A1", for production use "INFO, syslog" # When running in eclipse use "INFO, syslog, A1", for production use "INFO, syslog"
log.rootCategory = INFO, syslog, A1 log.rootCategory = INFO, syslog, A1
# how to load the brasato "framework" - usually "jar" suffices but
# for developers project sources are also possible e.g.,
# e.g. C:/eclipse/workspace/olatcore/src/main/java/
# or /home/myuser/workspaces/olatcore/src/main/java
olatcore.src=/home/roman/workspace/OLAT-7.1.x/olatcore/src/main/java
# relative path to # relative path to
relpathto.src=../../../webapp/WEB-INF/src relpathto.src=../../../src
# if enabled then the IM Server must be running before OLAT is started! # if enabled then the IM Server must be running before OLAT is started!
......
...@@ -306,11 +306,11 @@ ...@@ -306,11 +306,11 @@
<filtering>true</filtering> <filtering>true</filtering>
</resource> </resource>
<resource> <resource>
<directory>src/main/profile</directory> <directory>src/main/profile</directory>
<includes> <includes>
<include>${os.property.file}</include> <include>${os.property.file}</include>
</includes> </includes>
<filtering>true</filtering> <filtering>true</filtering>
</resource> </resource>
</resources> </resources>
...@@ -375,8 +375,22 @@ ...@@ -375,8 +375,22 @@
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId> <artifactId>maven-eclipse-plugin</artifactId>
<version>2.7</version> <version>2.8</version>
<configuration> <configuration>
<linkedResources>
<linkedResource>
<name>static</name>
<type>2</type>
<location>${basedir}/src/main/webapp/static</location>
</linkedResource>
<linkedResource>
<name>/src/main/java/olat.local.properties</name>
<type>1</type>
<location>${basedir}/olat.local.properties</location>
</linkedResource>
</linkedResources>
<wtpversion>2.0</wtpversion> <wtpversion>2.0</wtpversion>
<!-- context name for servlet container e.g. localhost:8080/olat --> <!-- context name for servlet container e.g. localhost:8080/olat -->
<wtpContextName>olat</wtpContextName> <wtpContextName>olat</wtpContextName>
...@@ -388,7 +402,6 @@ ...@@ -388,7 +402,6 @@
<plugin> <plugin>
<artifactId>maven-site-plugin</artifactId> <artifactId>maven-site-plugin</artifactId>
<version>2.2</version> <version>2.2</version>
</plugin> </plugin>
<!-- Surefire plugin used to execute unit tests. <!-- Surefire plugin used to execute unit tests.
"mvn -DskipTests=false test" to run all tests "mvn -DskipTests=false test" to run all tests
...@@ -473,7 +486,7 @@ ...@@ -473,7 +486,7 @@
</execution> </execution>
</executions> </executions>
<configuration> <configuration>
<srcdir>${basedir}/../webapp/WEB-INF/src/</srcdir> <srcdir>${basedir}/src/</srcdir>
<includes> <includes>
<include>org/olat/restapi/**/*VO.java</include> <include>org/olat/restapi/**/*VO.java</include>
<include>org/olat/user/restapi/**/*VO.java</include> <include>org/olat/user/restapi/**/*VO.java</include>
...@@ -568,7 +581,7 @@ ...@@ -568,7 +581,7 @@
<properties> <properties>
<property> <property>
<name>applicationDocsFile</name> <name>applicationDocsFile</name>
<value>${basedir}/../webapp/WEB-INF/src/org/olat/restapi/support/application-doc.xml</value> <value>${basedir}/src/org/olat/restapi/support/application-doc.xml</value>
</property> </property>
</properties> </properties>
</wadlGeneratorDescription> </wadlGeneratorDescription>
...@@ -577,7 +590,7 @@ ...@@ -577,7 +590,7 @@
<properties> <properties>
<property> <property>
<name>grammarsFile</name> <name>grammarsFile</name>
<value>${basedir}/../webapp/WEB-INF/src/org/olat/restapi/support/application-grammars.xml</value> <value>${basedir}/src/org/olat/restapi/support/application-grammars.xml</value>
</property> </property>
</properties> </properties>
</wadlGeneratorDescription> </wadlGeneratorDescription>
...@@ -612,7 +625,7 @@ ...@@ -612,7 +625,7 @@
<include>application.wadl</include> <include>application.wadl</include>
</includes> </includes>
<outputDir>${project.build.outputDirectory}</outputDir> <outputDir>${project.build.outputDirectory}</outputDir>
<stylesheet>${basedir}/../webapp/WEB-INF/src/org/olat/restapi/support/wadl_documentation.xsl</stylesheet> <stylesheet>${basedir}/src/org/olat/restapi/support/wadl_documentation.xsl</stylesheet>
<fileMappers> <fileMappers>
<fileMapper <fileMapper
implementation="org.codehaus.plexus.components.io.filemappers.FileExtensionMapper"> implementation="org.codehaus.plexus.components.io.filemappers.FileExtensionMapper">
......
#!/bin/bash
# Checks for changes in the translation directory, updates them and checks
# them in to the OLAT svn
# 19.11.2004
# gnaegi@id.unizh.ch
# updated to use with svn, 11.4.2006, alexander.schneider@id.unizh.ch
if [ "$1" = "" ]; then
echo "Usage: checkin_translations.sh LOCALE Example: checkin_translations.sh en"
exit;
fi
#read locale as input parameter
LOCALE=$1
#LOG=/usr/local/olat/translationlog/$LOCALE-trans-$(date +%Y%m%d).log
LOG=/usr/local/opt/nightly/translationlog/$LOCALE-trans-$(date +%Y%m%d).log
cd /usr/local/opt/nightly/olat4/
#cd /usr/local/opt/nightly/olatlive/
echo -e "Starting SVN update for locale $LOCALE\n" >> $LOG
echo -e "---------------------------------------\n" >> $LOG
UPDATE=`svn update webapp/i18n/default/$LOCALE/` > /dev/null 2> /dev/null
echo $UPDATE | grep "^M.*" >> $LOG
echo $UPDATE | grep "^P.*" >> $LOG
CONFLICTS=`echo $UPDATE | grep "^C.*"` 2> /dev/null
# abort when any conflicts are found and send email to developers
if [ "$CONFLICTS" != "" ]; then
echo "****** Conflicts found in" >> $LOG
echo $CONFLICTS >> $LOG
echo "****** Fix them manually !!" >> $LOG
echo $CONFLICTS | mail -s "Conflicts found while updating locale $LOCALE - fix them" -r "olat@olat.unizh.ch" id_olat@id.unizh.ch
exit;
fi
echo -e "Starting SVN diffs for locale $LOCALE\n" >> $LOG
echo -e "-------------------------------------\n" >> $LOG
svn diff webapp/i18n/default/$LOCALE/ >> $LOG 2> /dev/null
# TODO: check for conflicts here, proceed only when no conflicts are here
echo -e "Checking in changes for locale $LOCALE\n" >> $LOG
echo -e "------------------ -------------------\n" >> $LOG
svn ci -m "Translation changes in $LOCALE" webapp/i18n/default/$LOCALE/ >> $LOG 2> /dev/null
echo -e "\n\n" >> $LOG
#!/bin/sh
echo "NIGHTLY START"
# "** Sending DE changes diffs to ale"
/usr/local/opt/nightly/bin/notify_de_diffs.sh
#echo "** Processing translation DE"
/usr/local/opt/nightly/bin/SVNcheckin_translations.sh de
#echo "** Processing translation EN"
/usr/local/opt/nightly/bin/SVNcheckin_translations.sh en
#echo "** Processing translation FR"
/usr/local/opt/nightly/bin/SVNcheckin_translations.sh fr
#echo "** Processing translation IT"
/usr/local/opt/nightly/bin/SVNcheckin_translations.sh it
#echo "** Processing translation ES"
/usr/local/opt/nightly/bin/SVNcheckin_translations.sh es
#echo "** Processing translation GR"
/usr/local/opt/nightly/bin/SVNcheckin_translations.sh gr
#echo "** Processing translation CZ"
/usr/local/opt/nightly/bin/SVNcheckin_translations.sh cz
#echo "** Processing translation PL"
/usr/local/opt/nightly/bin/SVNcheckin_translations.sh pl
#echo "** Processing translation RU"
/usr/local/opt/nightly/bin/SVNcheckin_translations.sh ru
#echo "** Processing translation DK"
/usr/local/opt/nightly/bin/SVNcheckin_translations.sh dk
export JAVA_HOME=/usr/local/opt/java-1.5
export ANT_HOME=/usr/local/opt/ant
export CATALINA_HOME=/usr/local/opt/nightly/tomcat
export LANG=de_CH
echo "** Stopping Tomcat..."
$CATALINA_HOME/bin/shutdown.sh
cd /usr/local/opt/nightly/olat4/
#cd /usr/local/opt/nightly/olatlive/
echo "** Running nightly build..."
ant -logfile ../build.log -logger org.apache.tools.ant.listener.MailLogger SVNnightly
echo "** run ant config-deploy-all"
ant config-deploy-all
echo "** Starting Tomcat..."
cd /usr/local/opt/nightly/olatdata/logs
$CATALINA_HOME/bin/startup.sh
echo "NIGHTLY STOP"
\ No newline at end of file
#!/bin/bash
# script that checks for unused properties in all spring config files.
# start script outside olat3 / olatcore folder but names must match olat3 olatcore
#
# date: 17.01.2011
# autor: Guido Schnider
declare -A proptofile
for prop in `cat ./olat3/webapp/WEB-INF/src/serviceconfig/olat.properties | grep -v '^$' | grep -v '#' | cut -d= -f1`
do
#echo $prop
proptofile["$prop"]=0
done
for file in `find olat3 olatcore -name '*.xml'`
do
for prop in `cat ./olat3/webapp/WEB-INF/src/serviceconfig/olat.properties | grep -v '^$' | grep -v '#' | cut -d= -f1`
do
found=`grep $prop $file | wc -l`
if [ $found -gt 0 ]; then
times=${proptofile[$prop]}
total=$(( $times + $found ))
proptofile["$prop"]=$total
#echo "$prop found $found time(s) in $file"
fi
done
done
echo ""
echo " Properties with a "- 0" are not used in xml spring files. Ignore .values and .comment prop as they are only used for comments"
echo ""
for property in ${!proptofile[@]}
do
echo "$property - ${proptofile[$property]}"
done
\ No newline at end of file
#!/bin/bash
# Checks for changes in the translation directory, updates them and checks
# them in to the OLAT cvs
# 19.11.2004
# gnaegi@id.unizh.ch
export CVSROOT=:ext:nightly@cvs.olat.org:/usr/local/cvs/
export CVS_RSH=ssh
LOG=/usr/local/opt/nightly/translationlog/trans-$(date +%Y%m%d).log
cd /usr/local/opt/nightly/olatlive
echo -e "Starting CVS update for all locales \n" >> $LOG
echo -e "---------------------------------------\n" >> $LOG
UPDATE=`find . -type f -name 'LocalStrings_*' | xargs cvs -n update` > /dev/null 2> /dev/null
echo $UPDATE | grep "^M.*" >> $LOG
echo $UPDATE | grep "^P.*" >> $LOG
CONFLICTS=`echo $UPDATE | grep "^C.*"` 2> /dev/null
# abort when any conflicts are found and send email to developers
if [ "$CONFLICTS" != "" ]; then
echo "****** Conflicts found in" >> $LOG
echo $CONFLICTS >> $LOG
echo "****** Fix them manually !!" >> $LOG
echo $CONFLICTS | mail -s "Conflicts found while updating - fix them" -r "olat@olat.unizh.ch" id_olat@id.unizh.ch
exit;
fi
echo -e "Starting CVS diffs for all locales \n" >> $LOG
echo -e "-------------------------------------\n" >> $LOG
cvs diff webapp/WEB-INF/src/ >> $LOG 2> /dev/null
# TODO: check for conflicts here, proceed only when no conflicts are here
echo -e "Checking in changes for all locales \n" >> $LOG
echo -e "------------------ -------------------\n" >> $LOG
find /usr/local/opt/nightly/olatlive/webapp/WEB-INF/src/org/olat/ -type f -name 'LocalStrings_*' -print0 | xargs -0 cvs add >> $LOG
find /usr/local/opt/nightly/olatlive/webapp/WEB-INF/src/org/olat/ -type f -name 'LocalStrings_*' | xargs cvs ci -m "Translation changes" >> $LOG 2> /dev/null >> $LOG
echo -e "\n\n" >> $LOG
#!/usr/bin/perl
#
# Try to figure out where the files found in the _chelp directories are used and
# list the files for which no usage can be figured out.
#
# Warning: the results are not very reliable because it depends on coding style etc.
# of the scanned source files (java and html)
#
# Author: Matthai Kurian
#
my $d = $0;
$d =~ s!/?[^/]*/*$!!;
$od = $d . '/../webapp/WEB-INF/src/org/olat';
$cd = $d . '/../../olatcore/src/main/java';
die 'Could not find olat3' unless -d $od;
die 'Could not find olatcore' unless -d $cd;
my @srcfiles;
my @chelpfiles;
my $usedin;
my @paramized;
# Special known cases we do not search for
push (@paramized, "statistic_(.*).html");
print "Scanning $od for chelp files...";
&findChelpFiles($od);
print "done.\n";
print "Scanning $cd for chelp files...";
&findChelpFiles($cd);
print "done.\n";
print "Scanning source files ...";
foreach $f (@srcfiles) {
$f =~ s/[^\/]+\/\.\.\///;
$f =~ s/[^\/]+\/\.\.\///;
open (F, $f);
@l=<F>;
foreach ($f) {
/\.java$/ and do {
foreach (@l) {
if (/setFormContextHelp\s?\([\s"']*([^'"]+)[\s"']*,[\s"']*([^'"]+)[\s"']*,[\s"']*([^'"]+)[\s"']*\)/) {
if (defined ($usedin->{$2})) {
push (@{$usedin->{$2}},$f);
next;
}
}
if (/setFormContextHelp\s?\("(.*),\s?"((.*)"\+(.*)\+"(.*)"),(.*)\)/) {
#print "Parametrized $3\+$4\+$5 chelp file: $f\n";
push (@paramized, "$3(.*)$5");
}
}
break;
};
/\.htm$/ and do {
foreach (@l) {
if (/javascript:contextHelpWindow\s?\('(.*)\/(.*)'\)/) {
push (@{$usedin->{$2}},$f);
next;
}
}
};
/\.html$/ and do {
foreach (@l) {
if (/\$r\.contextHelpRelativeLink\s?\([\s"]*([^"]+)[\s"]*,[\s"]*([^"]+)[\s"]*\)/) {
if (defined $usedin->{$2}) {
push (@{$usedin->{$2}},$f);
}
next;
}
if (/\$r\.contextHelp\s?\([\s"']*([^'"]+)[\s"']*,[\s"']*([^'"]+)[\s"']*,[\s"']*([^'"]+)[\s"']*\)/) {
if (defined $usedin->{$2}) {
push (@{$usedin->{$2}},$f);
}
next;
}
if (/\$r\.contextHelpWithWrapper\s?\([\s"']*([^'"]+)[\s"']*,[\s"']*([^'"]+)[\s"']*,[\s"']*([^'"]+)[\s"']*\)/) {
if (defined $usedin->{$2}) {
push (@{$usedin->{$2}},$f);
next;
}
my $p = $2;
if ($2 =~ /\${(.*)}/) {
$p =~ s/\${(.*)}/(.*)/;
#print "Parametrized >$p< \${$1} chelp file: $f\n";
push (@paramized, $p);
}
next;
}
if (/javascript:contextHelpWindow\s?\('(.*)'\)/) {
$1 =~ /\$r\.relLink\("help\/\${r.getLanguageCode\(\)}\/(.*)\/(.*)"\)/;
push (@{$usedin->{$2}},$f);
next;
}
if (/\$r\.contextHelpRelativeLink\s?\([\s"]*([^"]+)[\s"]*\)/) {
if (defined $usedin->{$1}) {
push (@{$usedin->{$1}},$f);
}
next;
}
if (/<img src="\$chelpStaticDirUrl\/([^"]*)"(.*)?>/) {
$if = $1;
$if =~ s/\.png//;
foreach (@chelpfiles) {
if (/$if_(..)\.png$/) {
if (defined $usedin->{$if.'_'.$1.'.png'}) {
push (@{$usedin->{$if.'_'.$1.'.png'}}, $f);
}
}
}
}
}
break;
};
}
}
print "done.\n";
# consider patterns found for parametrized use
foreach $h (@chelpfiles) {
$x=join (',', @{$usedin->{$h}});
if ($x =~ /^$/) {
foreach $p (@paramized) {
if($h =~ m/($p)/) {
push (@{$usedin->{$h}}, $p);
}
}
}
}
my $unused = 0;
foreach $h (@chelpfiles) {
$x=join (',', @{$usedin->{$h}});
if ($x =~ /^$/) {
print 'Cound not figure out usage of chelp file >'.$h."<\n";
$unused++;
}
}
print "$#chelpfiles chelp files found $#srcfiles files scanned. ";
print "$unused unused chelp files found.\n";
foreach (@chelpfiles) {
print "\n$_\n";
my %d;
foreach $u (@{$usedin->{$_}}) {
if (!defined $d{$u}) {
$d{$u}=1;
}
}
foreach (sort keys (%d)) {
print "\t$_\n";
}
}
sub findChelpFiles () {
my ($p) = @_;
if (-f $p) {
push (@srcfiles, $p);
if ($p =~ /\/_chelp\//) {
$f = (split(/\//, $p))[-1];
push (@chelpfiles, $f);
$usedin->{$f}=[];
}
return;
}
opendir (D, $p);
foreach (readdir (D)) {
chomp;
next if /^\.$/;
next if /^\.\.$/;
next if /^CVS$/;
&findChelpFiles("$p/$_");
}
}
#!/bin/sh
## counts unique logins out of one or more olat log files.
## Usage: count-unique-users.sh filename1 filename2 ...
for l in `ls $1`
do
awk 'BEGIN{FS="\\^%\\^"}/Logged.on/{split($1,tmp," ");start=index($9,"[");end=index($9,"]");msg=substr($9,start+1,end-start-1);print msg}' $l | sort -u | wc -l
echo $res
done
# send sms to users when the error count is bigger than specified
# only works with Switch.ch sms service!
# path to OLAT log files
cd /usr/local/opt/olat/olatdata/logs
# add numbers here
HANDY02=0041*********
HANDY03=0041*********
HANDY04=0041*********
CUTVALUE=180
ERRORCOUNT=`grep 'OLAT::ERROR' olat.log | wc -l`
if [ "$ERRORCOUNT" -gt "$CUTVALUE" ]
then
echo "Error count ($ERRORCOUNT) bigger than cut value ($CUTVALUE)." | /usr/bin/mail -s "OLAT alert!" -r "id_olat@olat.unizh.ch" $HANDY02@sms.switch.ch $HANDY03@sms.switch.ch $HANDY04@sms.switch.ch
fi
#!/bin/bash
#############################################################################
# Initial database setup script: will generate db user and an olat database #
# 11. July 2004 Florian Gngi #
#############################################################################
echo "This script will create a database user and a database for OLAT on your MySQL server. Do you want to continue? (y|n)"
read Y
if [ "$Y" != "y" ]; then
echo byby
exit
fi
# collect user dbname, username, password
echo Enter your OLAT database name:
read OLATDB
echo Enter your OLAT database user:
read OLATUSER
echo Enter the password for database user $OLATUSER:
read OLATPWD
# create mysql db query
QUERY="CREATE DATABASE $OLATDB; GRANT ALL PRIVILEGES ON $OLATDB.* TO '$OLATUSER'@'localhost' IDENTIFIED BY '$OLATPWD';"
# executing query
echo Generating now the OLAT database user $OLATUSER with the password $OLATDB that has access to the database $OLATDB
echo You must now enter the MySQL root user password:
mysql -u root -p mysql -e "$QUERY"
echo "User generated. Try login now with 'mysql -u $OLATUSER -p $OLATDB'"
#!/bin/sh
# Generates a disk usage report
# 19.11.2004
# gnaegi@id.unizh.ch
TOMAIL="olat@olat.unizh.ch"
FROMMAIL="id_olat@id.unizh.ch"
cd /usr/local/opt/olat/olatdata/
rm -f quota.txt
uname -a >> quota.txt
echo -e "-------------------------------------\n" >> quota.txt
echo -e "Disk Usage of olatdata directory" >> quota.txt
echo -e "-------------------------------------\n" >> quota.txt
du -hs --exclude=bcroot --exclude=quota.txt--exclude=quota.txt ??* >> quota.txt
du -h --max-depth=1 bcroot >> quota.txt
du -hs . >>quota.txt
echo -e "\n\nFilesystem Totals" >> quota.txt
echo -e "-------------------------------------\n" >> quota.txt
df -h >> quota.txt
echo -e "\n\nTop-10 space waster statistics (in MB)" >> quota.txt
echo -e "-------------------------------------\n" >> quota.txt
echo -e "Top 10 course folder:" >> quota.txt
du --block-size=1MB --max-depth=1 bcroot/course/ | sort -gr | head -n 11 | tail -n 10 >> quota.txt
echo -e "\nTop 10 user homes:" >> quota.txt
du --block-size=1MB --max-depth=1 bcroot/homes/ | sort -gr | head -n 11 | tail -n 10 >> quota.txt
echo -e "\nTop 10 group folders:" >> quota.txt
du --block-size=1MB --max-depth=1 bcroot/cts/folders/BusinessGroup/ | sort -gr | head -n 11 | tail -n 10 >> quota.txt
echo -e "\nTop 10 repository entries:" >> quota.txt
du --block-size=1MB --max-depth=1 bcroot/repository/ | sort -gr | head -n 11 | tail -n 10 >> quota.txt
less quota.txt 2>&1 | mail -s "Nightly OLAT disk usage report" -r $FROMMAIL $TOMAIL
#!/bin/bash
###
# Bash script based on basic linux command line tools to log in to OLAT start a course
# from the home and logout again.
# Install: Create a user with a password in OLAT and disable the AJAX mode for this user.
# This user should have one bookmark to a course on his home screen.
#
# initial date: 4. Sept. 2007
# author: Guido Schnider
## output in logfile should look like this, if not all url's are present olat is in ajax mode or the performace
# user does need the necessary *single* bookmark to a course which is mandatory! CHECK THIS!
# testing: idolats0.uzh.ch:8082 with user: performance-test-user-2
# START: 1233593485 (CUT_TIME: 11)
# Mon Feb 2 17:51:26 CET 2009 LOGIN_FORM /olat/dmz/1%3A2%3A2002298189%3A2%3A0%3Acid%3Alogin/?lp=OLAT
# Mon Feb 2 17:51:27 CET 2009 LOGIN /olat/dmz/1%3A3%3A2002298347%3A1%3A0/
# Mon Feb 2 17:51:31 CET 2009 LAUNCH_COURSE /olat/auth/1%3A2%3A2002298546%3A1%3A0%3Ar%3A0%3Ap%3Acmd.launch/
# Mon Feb 2 17:51:34 CET 2009 LOGOUT /olat/auth/1%3A3%3A2002298388%3A2%3A0%3Acid%3Alogout/
# STOP: 1233593495
# PROCESSTIME (STOP-START-SLEEPTIME(9s)): 1
# ===========================================
sendErrorSMS()
{
for name in $receivers
do
echo `date`" error - olat server ($domain) not available by auto loginscript!" | /usr/bin/mail -s "OLAT performance alert!" ~R "id_olat@olat.uzh.ch" $name@sms.switch.ch
done
}
sendPerformanceSMS()
{
for name in $receivers
do
echo `date`"OLAT ($domain) is slow! Login->start course->logout took ($PROCESSTIME)s" | /usr/bin/mail -s "OLAT performance alert!" ~R "id_olat@olat.uzh.ch" $name@sms.switch.ch
done
}
#Chooses random one of the entries below and tries to login
let "n=$RANDOM % 4"
#add http:// or https:// and port as well if needed
domains=("http://idolatc00.internal.uzh.ch:8084" "http://idolatc00.internal.uzh.ch:8085" "http://idolatc02.internal.uzh.ch:8082" "http://idolatc02.internal.uzh.ch:8083" "https://www.olat.uzh.ch")
domain=${domains[$n]}
let "n=$RANDOM % 2"
usernames=("test-user" "test-user-2")
username=${usernames[$n]}
password="secret"
cutTime="11"
## add SMS receivers
##HANDY01=12344556
HANDY02=12344556
HANDY03=12344556
#################################################
# ADD receivers here separated by blank!
#################################################
receivers="$HANDY01 $HANDY02 $HANDY03"
LOG="/var/log/OLATautologin.log"
echo "testing: $domain with user: $username" >> ${LOG}
start=`date +%s`
echo "START: ${start} (CUT_TIME: ${cutTime})" >> ${LOG}
#grab loginpage and extract form action uri
wget -o temp-log0 -O temp-startpage.html --no-check-certificate --save-cookies cookies.txt --keep-session-cookies $domain/olat/dmz/
sleep 1
# THIS step is optional - ONLY needed to get the normal (username/pw) loginform to front when shibboleth login is active
#open normal login form page not shibboleth
loginuri=`grep '?lp=OLAT' temp-startpage.html | sed 's/^.*href="//' | sed 's/".*$//'`
echo `date`" LOGIN_FORM ${domain}${loginuri}" >> ${LOG}
#echo $loginuri
wget -o temp-log1 -O temp-logform.html --no-check-certificate --save-cookies cookies.txt --keep-session-cookies --load-cookies cookies.txt $domain$loginuri
sleep 1
#must be 1 otherwise the server is not available
checkResponse=`grep 'name=\"loginForm\"' temp-logform.html | wc -l`
if [ $checkResponse == 1 ]
then
uri=`grep 'name=\"loginForm\"' temp-logform.html | sed 's/^.*action="//' | sed 's/".*$//'`
#echo $uri
#login with extracted uri and post method
echo `date`" LOGIN ${uri}" >> ${LOG}
wget -o temp-log2 -O temp-home.html --no-check-certificate --save-cookies cookies.txt --keep-session-cookies --load-cookies cookies.txt --post-data="lf_login=$username&lf_pass=$password&olat_fosm_0=Login" $domain$uri
#sleep to let the instant messenger connect
sleep 3
#start demo course from the homepage with direkt link, this only works if there a no other "cmd.launch" stuff is on the screen
# best is to remove all other portlets except the bookmarks portlet
courseuri=`grep 'cmd.launch\/' temp-home.html | sed 's/^.*href="//' | sed 's/".*$//'`
echo `date`" LAUNCH_COURSE ${courseuri}" >> ${LOG}
#echo $courseuri
#start course
wget -o temp-log3 -O temp-course.html --no-check-certificate --save-cookies cookies.txt --keep-session-cookies --load-cookies cookies.txt $domain$courseuri
#sleep to let the instant messenger create a chatroom
sleep 3
#extract logout uri for later usage
logouturi=`grep 'logout\/' temp-course.html | sed 's/^.*href="//' | sed 's/".*$//'`
#echo $logouturi
#logout
echo `date`" LOGOUT ${logouturi}" >> ${LOG}
wget -o temp-log4 -O temp-logout.html --no-check-certificate --save-cookies cookies.txt --keep-session-cookies --load-cookies cookies.txt $domain$logouturi
sleep 1
#send sms if time is too long
rm temp-*
rm cookies.txt
stop=`date +%s`
echo "STOP: ${stop}" >> ${LOG}
#substract the sleep times
echo `date`" time: "$(($stop-$start-9))
PROCESSTIME=$(($stop-$start-9))
echo "PROCESSTIME (STOP-START-SLEEPTIME(9s)): ${PROCESSTIME}" >> ${LOG}
if [ $PROCESSTIME -gt $cutTime ]
then
echo "OLAT IS SLOW !!!" >> ${LOG}
# only send sms after 6 o'clock in the morning (after restart phase and indexing)
if [ `date +%H` -gt 5 ]
then
sendPerformanceSMS
fi
fi
else
echo "OLAT NOT AVAILABLE BY AUTO LOGINSCRIPT" >> ${LOG}
if [ `date +%H` -gt 5 ]
then
sendErrorSMS
fi
fi
echo "===========================================" >> ${LOG}
#!/bin/sh
echo "NIGHTLY CORE BUILD START..."
# run as user nightly
export CVSROOT=:ext:nightly@cvs.olat.org:/usr/local/cvs
export CVS_RSH=ssh
echo change dir to /usr/local/opt/nightly
cd /usr/local/opt/nightly
# echo delete existing olatcore
rm -R olatcore
# echo CVS checkout
echo CVS update olatcore
/usr/bin/cvs co olatcore
# echo Change to dir olatcore
cd olatcore
echo Maven clean package
/usr/local/opt/maven/bin/mvn clean package
# 1.3 Copy JAR to olat3 project
# 1.4 Allfaellige JUnit-Tests laufen lassen (spaeter)
# 1.5 CVS checkin olatcore.jar into olat3
# First update olatcore-jar from cvs, perhaps it changed
echo Maven package DONE
echo Change to dir olat3/webapp/WEB-INF/lib
cd /usr/local/opt/nightly/olat3/webapp/WEB-INF/lib
echo CVS update of core-JAR
/usr/bin/cvs upd -dP olatcore-1.0-SNAPSHOT.jar
echo Copy core-JAR
cp /usr/local/opt/nightly/olatcore/target/olatcore-1.0-SNAPSHOT.jar /usr/local/opt/nightly/olat3/webapp/WEB-INF/lib/olatcore-1.0-SNAPSHOT.jar
echo CVS checkin core-JAR
/usr/bin/cvs ci -m'Nightly olatcore update' olatcore-1.0-SNAPSHOT.jar
echo Change to dir /usr/local/home/nightly/
cd /usr/local/home/nightly
echo "NIGHTLY CORE BUILD FINISHED"
##
## This script checks out olat3_i18n and olatcore_i18n, build jar files from them and copies the jars into the olat3/webapp/WEB-INF/lib directory
##
#!/bin/sh
echo "NIGHTLY olatcore_i18n BUILD START..."
# run as user nightly
export CVSROOT=:ext:nightly@cvs.olat.org:/usr/local/cvs
export CVS_RSH=ssh
echo change dir to /usr/local/opt/nightly
cd /usr/local/opt/nightly
# echo delete existing olatcore_i18n
rm -R olatcore_i18n
# echo CVS checkout
echo CVS update olatcore_i18n
/usr/bin/cvs co olatcore_i18n
# echo Change to dir olatcore_i18n
cd olatcore_i18n
echo Maven clean package
/usr/local/opt/maven/bin/mvn clean package
echo Maven package DONE
echo Change to dir olat3/webapp/WEB-INF/lib
cd /usr/local/opt/nightly/olat3/webapp/WEB-INF/lib
echo CVS update of olatcore_i18n-JAR
/usr/bin/cvs upd -dP olatcore_i18n_all-SNAPSHOT.jar
echo Copy core_i18n-JAR
cp /usr/local/opt/nightly/olatcore_i18n/target/olatcore_i18n_all-SNAPSHOT.jar /usr/local/opt/nightly/olat3/webapp/WEB-INF/lib/olatcore_i18n_all-SNAPSHOT.jar
echo CVS checkin olatcore-JAR
/usr/bin/cvs ci -m'Nightly olatcore_i18n update' olatcore_i18n_all-SNAPSHOT.jar
echo Change to dir /usr/local/home/nightly/
cd /usr/local/home/nightly
echo "NIGHTLY olatcore_i18n BUILD FINISHED"
## now the same for olat3_i18n
echo "NIGHTLY olat3_i18n BUILD START..."
# run as user nightly
export CVSROOT=:ext:nightly@cvs.olat.org:/usr/local/cvs
export CVS_RSH=ssh
echo change dir to /usr/local/opt/nightly
cd /usr/local/opt/nightly
# echo delete existing olat3_i18n
rm -R olat3_i18n
# echo CVS checkout
echo CVS update olat3_i18n
/usr/bin/cvs co olat3_i18n
# echo Change to dir olat3_i18n
cd olat3_i18n
echo Maven clean package
/usr/local/opt/maven/bin/mvn clean package
echo Maven package DONE
echo Change to dir olat3/webapp/WEB-INF/lib
cd /usr/local/opt/nightly/olat3/webapp/WEB-INF/lib
echo CVS update of olat3_i18n-JAR
/usr/bin/cvs upd -dP olat3_i18n_all-SNAPSHOT.jar
echo Copy core_i18n-JAR
cp /usr/local/opt/nightly/olat3_i18n/target/olat3_i18n_all-SNAPSHOT.jar /usr/local/opt/nightly/olat3/webapp/WEB-INF/lib/olat3_i18n_all-SNAPSHOT.jar
echo CVS checkin olat3-JAR
/usr/bin/cvs ci -m'Nightly olat3_i18n update' olat3_i18n_all-SNAPSHOT.jar
echo Change to dir /usr/local/home/nightly/
cd /usr/local/home/nightly
echo "NIGHTLY olat3_i18n BUILD FINISHED"
#!/bin/bash
# Checks for changes in the translation directory, updates them and checks
# them in to the OLAT cvs
# 19.11.2004
# gnaegi@id.unizh.ch
export CVSROOT=:ext:nightly@cvs.olat.org:/usr/local/cvs/
export CVS_RSH=ssh
DEDIFFSNOTIFICATION="webmaster@myolat.com"
cd /usr/local/opt/nightly/olatlive/webapp/WEB-INF
find src -type f -name 'LocalStrings_de*' -print0 | xargs -0 cvs diff >dediff.diff 2>/dev/null
DIFF=`cat dediff.diff`
# abort when any conflicts are found and send email to developers
if [ "$DIFF" != "" ]; then
cat dediff.diff | mail -s "Changes found in DE locale - notify translators if needed" -r olat@olat.unizh.ch $DEDIFFSNOTIFICATION
fi
rm dediff.diff
#!/bin/bash
#
# olat_backup.sh - olat backup script
#
# script name : olat_backup.sh
# script version : 1.2.4
# script author : OLAT/ID
# script created : 2004
# script changed : 2008/08/12
#
# notes
# -----
#
# Backup script. RUN AS ROOT
#
# change history
# --------------
#
# 08/08/13 version 1.2.4
# - message handling now instance-dependent
# 08/08/12 version 1.2.3
# - bugfixed logrotate logfile nameing
# 08/08/07 version 1.2.2
# - added activemq handling
# 08/08/05 version 1.2.1
# - updated instances
# 08/07/08 version 1.2.1
# - instance base dir now /usr/local/olatlocal for all
# - added new instances :
# olat01,olat02,olat03,olat04,olatsh01
# 08/03/11 version 1.2.0
# - changed commands
# - bugfixed commandline handling
# - adapted changes from old olatbackup script version 1.1.7
# - runs sharedmemstat --allusers --clean if present before
# service restart
# - restartMysql splitted into start/stop and wait functions
# - print out netstat status of port 8009 to logfile while waiting
# 08/01/26 version 1.1.6-ng
# - changed for olat-ng layout
# 07/11/23 version 1.1.5-ng
# - changed for olat-ng layout
# 07/11/22 version 1.1.5
# - added --optimize option taht causes execution
# of 'mysqlcheck -Aao1' before dumping the databases
# 07/11/14 version 1.1.4
# - save gc.log before stopping tomcat. If saving after, it's empty. (asch)
# 07/11/09 version 1.1.3
# - check for existance of gc.log before copying it
# - corrected syslogrc definition
# 07/10/05 version 1.1.2
# - before stoping tomcat save garbage collector log (asch)
# 07/09/25 version 1.1.1
# - restartmysql now calls logrotate and forces a
# syslog restart to make sure
# 07/08/23 version 1.1.0
# - major rewrite
# - auto-detect mysql databases and password
# 07/08/23 version 1.0.6
# - jivemessenger rename to messaging
# 07/06/22 version 1.0.5
# - do not call mysqldump with xcall
# 07/06/21 version 1.0.4
# - xcall now logs to file
# - argument parsing for --test etc
# 07/06/20 version 1.0.3
# - setup for idmels04
# - wildfire renamed to openfire
# 06/11/09 version 1.0.2
# - setup for idmels02, handle all instances
# 06/08/24 version 1.0.1
# - wait 120 secs before restarting mysql
# 06/08/22 version 1.0.0
# - added forced apache kill
# - added version information
#
#
# script info
#
sname="olat_backup.sh"
sversion="1.2.4"
sdate="2008/08/13"
sinfo="olat backup script"
scpr="copyright (c) 2004..2008 by OLAT/ID"
scall="$0"
#
# script setup
#
busleep=120
bumessagewait=600
buinstances="id olat01 olat02 olat03 olat04 olatsh01"
budir=/usr/local/var/backups
bulogfile="/var/log/${sname}.message.log"
# used to construct instance message script file path
instanceBaseDir="/usr/local/olatlocal"
instanceMessage="olatlive/bin/olat_backup_message.sh"
defaultPasswd=""
defaultList="mysql test olat messaging"
apachebin="/usr/sbin/httpd2-prefork"
mysqlrc="/etc/init.d/mysql"
forceLogrotate=0
logrotatebin="/usr/sbin/logrotate"
logrotateopt="" # set to "-v" for more info
logrotateconf="/etc/logrotate.conf"
logrotatelog="/var/log/${sname}.logrotate.log"
forceSyslogRestart=0
syslogrc="/etc/init.d/syslog"
sharedmemstatbin="/usr/local/sbin/sharedmemstat"
verbose=1
logging=1
testMode=0
allowDefaults=0
doHelp=0
doVersion=0
doDump=0
doStart=0
doStop=0
doMessage=0
doOptimize=0
warnMsg=""
errMsg=""
errCode=0
#
# basic functions
#
xecho()
{
[ ${verbose} -gt 0 ] && echo -e $@
[ ${logging} -gt 0 ] && echo -e $@ >> ${bulogfile}
}
xcall()
{
if [ ${testMode} -ne 0 ] ; then
xecho " TEST: $@"
elif [ ${logging} -gt 0 ] ; then
eval $@ 2>&1 | tee -a ${bulogfile}
else
eval $@
fi
}
#
# database functions
#
getDatabaseList()
{
dbUser="root"
dbList=""
xecho -n " - reading password ... "
dbPasswd=`cat /etc/my.cnf | awk '$1=="password" && $2=="=" { print $3 }'`
##cat /etc/my.cnf | awk '$1=="password" && $2=="=" { print $3 }'
if [ -z "${dbPasswd}" ] && [ ${allowDefaults} -gt 0 ] ; then
${dbPasswd}=${defaultPasswd}
warnMsg="${errMsg}WARNING: could not detect mysql password, using default\n"
fi
if [ -z "${dbPasswd}" ] ; then
errMsg="${errMsg}ERROR: could not detect mysql password\n"
xecho "[error]"
else
xecho "[done]"
fi
xecho -n " - reading database list ... "
dbList=`mysql --user ${dbUser} --password="${dbPasswd}" -s -e "show databases ;" 2>/dev/null | grep -v Database | tr [:space:] ' '`
if [ -z "${dbList}" ] && [ ${allowDefaults} -gt 0 ] ; then
dbList="${defaultList}"
warnMsg="${errMsg}WARNING: could not detect mysql password, using default\n"
fi
if [ -z "${dbList}" ] ; then
errMsg="${errMsg}ERROR: could not get database list from mysql\n"
xecho "[error]"
else
xecho "[done]"
fi
if [ -n "${warnMsg}" ] ; then
echo -e ${warnMsg};
warnMsg=""
fi
if [ -n "${errMsg}" ] ; then
echo -e "${errMsg}"
exit 1
fi
xecho " - databases to backup: ${dbList}"
}
runOptimize()
{
[ ${doOptimize} -le 0 ] && return
xecho "`date '+%D-%T'`: optimizing mysql databases"
stat=0
dt=`date '+%s'`
if [ ${testMode} -gt 0 ] ; then
xecho "TEST: mysqlcheck --user ${dbUser} --password=${dbPasswd} -Aao1"
else
mysqlcheck --user ${dbUser} --password=${dbPasswd} -Aao1
stat=$?
fi
dt=$(( `date '+%s'` - ${dt} ))
xecho "`date '+%D-%T'`: optimization finished after ${dt} second(s), status=${stst}"
}
#
# tomcat handling
#
setupMessage()
{
[ ${doStop} -le 0 ] && return
[ ${doMessage} -le 0 ] && return
xecho "`date '+%D-%T'`: setting up service messages for tomcat instances"
doWait=0
for instance in ${buinstances} ; do
if [ "${instance}" = "id" ] ; then
iname="olat"
else
iname=${instance}
fi
idir=${instanceBaseDir}/${iname}
bum=${idir}/${instanceMessage}
if [ -x "${bum}" ] ; then
xecho -n "`date '+%D-%T'`: setup service message for instance ${instance} ... "
# countdown for shutting down tomcat
xcall nohup "${bum}" >> ${bulogfile} 2>&1 &
xecho "[done]"
doWait=${bumessagewait}
else
xecho "WARNING: could not find \"${bum}\", skipping"
fi
done
if [ ${doWait} -gt 0 ] ; then
## messages are set, now wait
xecho -n "`date '+%D-%T'`: waiting for message countdown (${doWait} sec(s)) ... "
xcall sleep ${doWait}
xecho "[done]"
fi
}
startTomcat()
{
[ ${doStart} -le 0 ] && return
for instance in ${buinstances} ; do
# starting tomcats
xecho "`date '+%D-%T'`: starting up tomcat instance ${instance}"
if [ -x "/etc/init.d/tomcat_${instance}" ] ; then
xcall /etc/init.d/tomcat_${instance} start --debug
else
xecho "WARNING: could not find \"/etc/init.d/tomcat_${instance}\", skipping"
fi
done
}
stopTomcat()
{
[ ${doStop} -le 0 ] && return
for instance in ${buinstances} ; do
# shutting down tomcats
xecho "`date '+%D-%T'`: stopping tomcat instance ${instance}"
if [ -x "/etc/init.d/tomcat_${instance}" ] ; then
xcall /etc/init.d/tomcat_${instance} stop --debug
xcall /etc/init.d/tomcat_${instance} kill --debug
xcall /etc/init.d/tomcat_${instance} KillJava --debug
else
xecho "WARNING: could not find \"/etc/init.d/tomcat_${instance}\", skipping"
fi
done
}
#
# openfire handling
#
startOpenfire()
{
[ ${doStart} -le 0 ] && return
xecho "`date '+%D-%T'`: starting openfire"
xcall /etc/init.d/openfire_id start --debug
xcall sleep 30
}
stopOpenfire()
{
[ ${doStop} -le 0 ] && return
xecho "`date '+%D-%T'`: shut down openfire"
if [ -x "/etc/init.d/openfire_id" ] ; then
xcall /etc/init.d/openfire_id stop --debug
xcall /etc/init.d/openfire_id kill --debug
xcall /etc/init.d/openfire_id KillJava --debug
else
xecho "WARNING: could not find \"/etc/init.d/openfire_id\", skipping"
fi
}
#
# activemq handling
#
startActiveMQ()
{
[ ${doStart} -le 0 ] && return
xecho "`date '+%D-%T'`: starting activemq"
xcall /etc/init.d/activemq_id start --debug
xcall sleep 30
}
stopActiveMQ()
{
[ ${doStop} -le 0 ] && return
xecho "`date '+%D-%T'`: shut down activemq"
if [ -x "/etc/init.d/activemq_id" ] ; then
xcall /etc/init.d/activemq_id stop --debug
xcall /etc/init.d/activemq_id kill --debug
xcall /etc/init.d/activemq_id KillJava --debug
else
xecho "WARNING: could not find \"/etc/init.d/activemq_id\", skipping"
fi
}
#
# java handling
#
javaKillAll()
{
[ ${doStop} -le 0 ] && return
xecho "`date '+%D-%T'`: one to kill em all "
if [ -x "/etc/init.d/tomcat_id" ] ; then
xcall /etc/init.d/tomcat_id KillAllJava --debug --force
else
xecho "WARNING: could not find \"/etc/init.d/tomcat_id\", skipping"
fi
}
#
# apache handling
#
startApache()
{
[ ${doStart} -le 0 ] && return
xecho "`date '+%D-%T'`: starting apache"
xcall /etc/init.d/apache2 start
}
stopApache()
{
[ ${doStop} -le 0 ] && return
## forced apache murder
xecho "`date '+%D-%T'`: shutdown apache"
xcall /etc/init.d/apache2 stop
if [ -f /var/run/httpd2.pid ] ; then
echo "WARNING: found /var/run/httpd2.pid"
kpid=`cat /var/run/httpd2.pid`
if [ -n "${kpid}" ] ; then
echo "WARNING: apache not stopped - using kill -KILL ${kpid}"
xcall kill -KILL ${kpid}
xcall sleep 1
fi
fi
kpid=`ps -e -o pid,comm | grep httpd | grep -v grep | awk '{ print $1 }' | tr [:space:] ' '`
if [ -n "${kpid}" ] ; then
echo "WARNING: apache not stopped - using kill -KILL ${kpid}"
xcall kill -KILL ${kpid}
xcall sleep 1
fi
kpid=`ps -e -o pid,comm | grep httpd | grep -v grep | awk '{ print $1 }' | tr [:space:] ' '`
if [ -n "${kpid}" ] ; then
echo "WARNING: apache still not stopped - using killall -KILL ${apachebin}"
xcall killall -KILL ${apachebin}
xcall sleep 1
fi
kpid=`ps -e -o pid,comm | grep httpd | grep -v grep | awk '{ print $1 }' | tr [:space:] ' '`
if [ -n "${kpid}" ] ; then
echo "ERROR: apache still not killed - giving up"
else
echo "NOTICE: apache is dead now - cleanup"
xcall rm -f found /var/run/httpd2.pid
fi
}
#
# mysql handling
#
stopMysql()
{
[ ${doStop} -le 0 ] && return
xecho "`date '+%D-%T'`: stopping mysql"
xcall ${mysqlrc} stop
}
startMysql()
{
[ ${doStart} -le 0 ] && return
xecho "`date '+%D-%T'`: start mysql"
xcall ${mysqlrc} start
}
dumpMysql()
{
[ ${doDump} -le 0 ] && return
if [ -n "${budir}" ] ; then
xcall mkdir -p ${budir}/last
##
for instance in ${dbList} ; do
if [ -f ${budir}/${instance}.sql.gz ] ; then
xecho "`date '+%D-%T'`: saving last dump to ${budir}/last"
xcall rm -f ${budir}/last/${instance}.sql.gz
xcall mv ${budir}/${instance}.sql.gz ${budir}/last
fi
xecho "`date '+%D-%T'`: dumping mysql database ${instance}"
if [ ${testMode} -gt 0 ] ; then
xecho "TEST: mysqldump --user ${dbUser} --password=${dbPasswd} ${instance} | gzip > ${budir}/${instance}.sql.gz"
else
mysqldump --user ${dbUser} --password="${dbPasswd}" ${instance} | gzip > ${budir}/${instance}.sql.gz
fi
done
fi
}
#
# other tools
#
forceLogrotate()
{
[ ${doStop} -le 0 ] && return
if [ ${forceLogrotate} -gt 0 ] ; then
xecho "`date '+%D-%T'`: force a logrotate"
cmd="${logrotatebin} ${logrotateopt} ${logrotateconf}"
if [ ${testMode} -ne 0 ] ; then
xecho " TEST: $cmd"
else
rm -f ${logrotatelog}
touch ${logrotatelog}
if [ -w "${logrotatelog}" ] ; then
xecho "`date '+%D-%T'`: ${cmd}"
eval ${cmd} > ${logrotatelog} 2>&1
else
xecho "`date '+%D-%T'`: WARNING - could not write to ${logrotatelog}"
xcall ${cmd}
fi
fi
xecho "`date '+%D-%T'`: --------------------------"
fi
if [ ${forceSyslogRestart} -gt 0 ] ; then
xecho "`date '+%D-%T'`: force a syslog restart"
xcall ${syslogrc} restart
xecho "`date '+%D-%T'`: --------------------------"
fi
}
cleanSharedMemory()
{
[ ${doStop} -le 0 ] && return
if [ ! -x "${sharedmemstatbin}" ] ; then
xecho "`date '+%D-%T'`: ${sharedmemstatbin} not found, skipping shared memory cleanup"
return
fi
xecho "`date '+%D-%T'`: shared memory cleanup:"
xcall ${sharedmemstatbin} --allusers --clean
}
pauseUntilRestart()
{
[ ${doStart} -gt 1 ] && [ ${doStop} -gt 1 ] && return
[ -z "${busleep}" ] && return
xecho "`date '+%D-%T'`: waiting for recovery sleep (${busleep} sec(s))"
secs=0
while [ ${secs} -lt ${busleep} ] ; do
if [ $(( ${secs} % 10 )) -eq 0 ] ; then
date '+%D-%T' >> ${bulogfile}
netstat -antp | grep 8009 >> ${bulogfile}
fi
[ ${testMode} -eq 0 ] && sleep 1
secs=$(( ${secs} + 1 ))
done
xecho "`date '+%D-%T'`: done"
}
###
### main program starts here
###
for arg in $@ ; do
case "${arg}" in
--allowdefaults) allowDefaults=1 ;;
--backup) doStart=1 ; doStop=1 ; doOptimize=1 ; doDump=1; doMessage=1 ;;
--dump) doDump=1 ;;
--dumponly) doStart=0 ; doStop=0 ; doOptimize=0 ; doDump=1; doMessage=0 ;;
--message) doMessage=1 ;;
--help) doHelp=1 ;;
--logrotate) forceLogrotate=1 ;;
--nologrotate) forceLogrotate=0 ;;
--nomessage) doMessage=0 ;;
--nooptiomize) doOptimize=0 ;;
--nosleep) busleep=10 ;;
--nosyslogrestart) forceSyslogRestart=1 ;;
--notest) testMode=0 ;;
--nowait) bumessagewait=10 ;;
--optimize) doOptimize=1 ;;
--optimizeonly) doStart=0 ; doStop=0 ; doOptimize=1 ; doDump=0; doMessage=0 ;;
--restartonly) doStart=1 ; doStop=1 ; doOptimize=0 ; doDump=0; doMessage=0 ;;
--startonly) doStart=1 ; doStop=0 ; doOptimize=0 ; doDump=0; doMessage=0 ;;
--stoponly) doStart=0 ; doStop=1 ; doOptimize=0 ; doDump=0; doMessage=0 ;;
--syslogrestart) forceSyslogRestart=1 ;;
--test) testMode=1 ;;
--version) doVersion=1 ;;
*) [ -n "${arg}" ] && errMsg="${errMsg}ERROR: invalid argument \"${arg}\"\n" ;;
esac
done
action=$(( ${doStart} + ${doStop} + ${doDump} + ${doOptimize} + ${doHelp} + ${doVersion} ))
na=$(( ${action} + ${doHelp} + ${doVersion} ))
if [ ${na} -le 0 ] ; then
errMsg="${errMsg}ERROR: missing argument(s)\n"
fi
touch "${bulogfile}"
[ -f "${bulogfile}" ] || logging=0
xecho "\n### ${sname} version ${sversion} - ${sdate}\n### ${sinfo}\n"
[ ${doVersion} -gt 0 ] && exit 0
if [ -n "${errMsg}" ] ; then
echo -e "${errMsg}"
doHelp=1
errCode=2
fi
if [ ${doHelp} -gt 0 ] ; then
echo -e "Usage: ${sname} [--options]"
echo " avaliable options are : "
echo " --allowdefaults) allow run with default setting (handle with care)"
echo " --backup) full backup (stop/optimize/dump/start)"
echo " --dump enable dump"
echo " --dumponly dump only"
echo " --help show this help"
echo " --message enable service message "
echo " --logrotate enable forced logrotate"
echo " --nologrotate disable forced logrotate"
echo " --nomessage disable service message "
echo " --nooptiomize disable optimization"
echo " --nosleep reduce sleep after backup (120->10s)"
echo " --nosyslogrestart disable forced syslog restart"
echo " --notest disable test mode"
echo " --nowait reduce message hold time (600->10s)"
echo " --optimize enable optimization"
echo " --optimizeonly optimize only"
echo " --restartonly restart services only"
echo " --startonly start services only"
echo " --stoponly stop services only"
echo " --syslogrestart enable forced syslog restart"
echo " --test run in test mode"
echo " --version show version and exit"
echo
exit ${errCode}
fi
getDatabaseList
setupMessage
## save garbage collector log
DATE=`date +%Y-%m-%d`
[ -f /scratch/tmp/gc.log ] && cp /scratch/tmp/gc.log /scratch/tmp/gc.log_${DATE}
stopTomcat
stopOpenfire
stopActiveMQ
javaKillAll
stopApache
runOptimize
dumpMysql
stopMysql
forceLogrotate
cleanSharedMemory
pauseUntilRestart
startMysql
startApache
startActiveMQ
startOpenfire
startTomcat
xecho "`date '+%D-%T'`: finished\n"
exit ${errCode}
#!/bin/bash
# countdown for shutting down tomcat
# To find the token for this olatinstance search in the table
# o_property for a property that has the category "_o3_" and
# the name "maintenanceMessageToken".
token="XxXxXxXx"
# the url of this olatinstance
url="https://www.myolat.com"
/usr/bin/wget --no-check-certificate --bind-address=127.0.0.1 --spider "$url/olat/admin.html?cmd=setmaintenancemessage&token=$token&msg=In+10+Minuten+findet+das+taegliche+Datenbackup+statt+(Ausfallzeit+ca.+20+Minuten).+Bitte+loggen+Sie+sich+aus."
sleep 60
/usr/bin/wget --no-check-certificate --bind-address=127.0.0.1 --spider "$url/olat/admin.html?cmd=setmaintenancemessage&token=$token&msg=In+9+Minuten+findet+das+taegliche+Datenbackup+statt+(Ausfallzeit+ca.+20+Minuten).+Bitte+loggen+Sie+sich+aus."
sleep 60
/usr/bin/wget --no-check-certificate --bind-address=127.0.0.1 --spider "$url/olat/admin.html?cmd=setmaintenancemessage&token=$token&msg=In+8+Minuten+findet+das+taegliche+Datenbackup+statt+(Ausfallzeit+ca.+20+Minuten).+Bitte+loggen+Sie+sich+aus."
sleep 60
/usr/bin/wget --no-check-certificate --bind-address=127.0.0.1 --spider "$url/olat/admin.html?cmd=setmaintenancemessage&token=$token&msg=In+7+Minuten+findet+das+taegliche+Datenbackup+statt+(Ausfallzeit+ca.+20+Minuten).+Bitte+loggen+Sie+sich+aus."
sleep 60
/usr/bin/wget --no-check-certificate --bind-address=127.0.0.1 --spider "$url/olat/admin.html?cmd=setmaintenancemessage&token=$token&msg=In+6+Minuten+findet+das+taegliche+Datenbackup+statt+(Ausfallzeit+ca.+20+Minuten).+Bitte+loggen+Sie+sich+aus."
sleep 60
/usr/bin/wget --no-check-certificate --bind-address=127.0.0.1 --spider "$url/olat/admin.html?cmd=setmaintenancemessage&token=$token&msg=In+5+Minuten+findet+das+taegliche+Datenbackup+statt+(Ausfallzeit+ca.+20+Minuten).+Bitte+loggen+Sie+sich+aus."
sleep 60
/usr/bin/wget --no-check-certificate --bind-address=127.0.0.1 --spider "$url/olat/admin.html?cmd=setmaintenancemessage&token=$token&msg=In+4+Minuten+findet+das+taegliche+Datenbackup+statt+(Ausfallzeit+ca.+20+Minuten).+Bitte+loggen+Sie+sich+aus."
sleep 60
/usr/bin/wget --no-check-certificate --bind-address=127.0.0.1 --spider "$url/olat/admin.html?cmd=setmaintenancemessage&token=$token&msg=In+3+Minuten+findet+das+taegliche+Datenbackup+statt+(Ausfallzeit+ca.+20+Minuten).+Bitte+loggen+Sie+sich+aus."
sleep 60
/usr/bin/wget --no-check-certificate --bind-address=127.0.0.1 --spider "$url/olat/admin.html?cmd=setmaintenancemessage&token=$token&msg=In+2+Minuten+findet+das+taegliche+Datenbackup+statt+(Ausfallzeit+ca.+20+Minuten).+Bitte+loggen+Sie+sich+aus."
sleep 60
/usr/bin/wget --no-check-certificate --bind-address=127.0.0.1 --spider "$url/olat/admin.html?cmd=setmaintenancemessage&token=$token&msg=In+wenigen+Augenblicken+findet+das+taegliche+Datenbackup+statt+(Ausfallzeit+ca.+20+Minuten).+Bitte+loggen+Sie+sich+aus."
sleep 60
\ No newline at end of file
#!/bin/sh
# zip rotated logs
cd /usr/local/opt/olat/olatdata/logs/
gzip -9 apache_access_log.txt.1
gzip -9 apache_error_log.txt.1
gzip -9 mod_jk.log.txt.1
gzip -9 monitoring_log.txt.1
# move rotated logs into archive folder
mv apache_access_log.txt.1.gz archive/apache_access_log.txt.$(date +"%Y%m%d").gz
mv apache_error_log.txt.1.gz archive/apache_error_log.txt.$(date +"%Y%m%d").gz
mv mod_jk.log.txt.1.gz archive/mod_jk.log.txt.$(date +"%Y%m%d").gz
mv monitoring_log.txt.1.gz archive/monitoring_log.txt.$(date +"%Y%m%d").gz
This directory contains scripts useful for deploying, managing or running olat.
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment