r91250 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r91249‎ | r91250 | r91251 >
Date:05:52, 1 July 2011
Author:ariel
Status:ok
Tags:
Comment:
dump centralauth tables (run from cron)
Modified paths:
  • /branches/ariel/xmldumps-backup/dumpcentralauth.sh (added) (history)

Diff [purge]

Index: branches/ariel/xmldumps-backup/dumpcentralauth.sh
@@ -0,0 +1,37 @@
 2+#!/bin/bash
 3+
 4+if [ ! -z "$1" ]; then
 5+ configfile="$1"
 6+else
 7+ configfile="/backups-atg/wikidump.conf"
 8+fi
 9+wikiadmin=`egrep "^user=" "$configfile" | awk -Fuser= '{ print $2 }'`
 10+wikipass=`egrep "^password=" "$configfile" | awk -Fpassword= '{ print $2 }'`
 11+private=`egrep "^private=" "$configfile" | awk -Fprivate= '{ print $2 }'`
 12+mysqldump=`egrep "^mysqldump=" "$configfile" | awk -Fmysqldump= '{ print $2 }'`
 13+gzip=`egrep "^gzip=" "$configfile" | awk -Fgzip= '{ print $2 }'`
 14+if [ -z "$wikiadmin" -o -z "$wikipass" -o -z "$private" -o -z "$mysqldump" -o -z "$gzip" ]; then
 15+ echo "failed to find value of one of the following from config file $configfile:"
 16+ echo "wikiadmin, wikipass, private, mysqldump, gzip"
 17+ echo "exiting..."
 18+ exit 1
 19+fi
 20+dbcluster=`grep centralauth /apache/common/php/wmf-config/db.php | awk -F"'" ' { print $4 }'`
 21+wiki=`grep $dbcluster /apache/common/php/wmf-config/db.php | grep wiki | head -1 | awk -F"'" ' { print $2 }'`
 22+host=`echo 'echo wfGetLB()->getServerName(0);' | php /apache/common/php/maintenance/eval.php $wiki`
 23+if [ -z "$dbcluster" -o -z "$wiki" -o -z "$host" ]; then
 24+ echo "can't locate db server for centralauth, exiting."
 25+ exit 1
 26+fi
 27+tables="global_group_permissions global_group_restrictions global_user_groups globalblocks globalnames globaluser globaluser_medium globaluser_old localnames localuser localuser_medium localuser_old migrateuser_medium wikiset"
 28+today=`date +%Y%m%d`
 29+dir="$private/centralauth/$today"
 30+mkdir -p "$dir"
 31+for t in $tables; do
 32+ outputfile="$dir/centralauth-$today-$t.gz"
 33+ echo "dumping $t into $outputfile"
 34+ "$mysqldump" -u "$wikiadmin" -p"$wikipass" -h "$host" --opt --quick --skip-add-locks --skip-lock-tables centralauth "$t" | "$gzip" > "$outputfile"
 35+done
 36+
 37+
 38+
Property changes on: branches/ariel/xmldumps-backup/dumpcentralauth.sh
___________________________________________________________________
Added: svn:eol-style
139 + native
Added: svn:executable
240 + *

Status & tagging log