Skip to content
Snippets Groups Projects
Commit eff81bf9 authored by srosse's avatar srosse
Browse files

no-jira: add some usefull scripts

parent c715ebdb
No related branches found
No related tags found
No related merge requests found
#!/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
#!/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/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 openolat.
\ 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