? Earlier 2 items total Later ?

On this page:?

Make a backup of all tables startin with...

This will backup all tables starting with "prefix_" to a gzipped file backup.sql.gz.

echo "SHOW TABLES" | mysql -uUSERNAME -pPASSWORD -D DBNAME | grep ^prefix_ | xargs mysqldump -uUSERNAME -pPASSWORD DBNAME | gzip -c > backup.sql.gz


You have to replace USERNAME, PASSWORD and DBNAME twice.

Note: On textdrive you want to add --skip-opt to mysqldump, otherwise the command will abort with an error because privs for lockings tables are missing (for me at least).

To check which tables were backed up, you can use:
zcat test.sql.gz | grep CREATE


Read http://dev.mysql.com/doc/mysql/en/mysqldump.html to find out which other options to add to mysqldump

Backing up subversion repositories from a remote machine

#!/usr/local/bin/bash
#
# Author: Jacques Marneweck 
# License: http://www.php.net/license/3_0.txt PHP License v3.0
# http://www.powertrip.co.za/

LOCALVER=`/usr/local/bin/svnlook youngest /home/svn/livejournal`
REMOTEVER=`/usr/bin/ssh jacques@hostname /usr/local/bin/svnlook youngest /home/svn/livejournal`
echo "Local version is ${LOCALVER}"
echo "Remote version is ${REMOTEVER}"

if [ "$REMOTEVER" -gt "$LOCALVER" ];
then
  echo "Remote version is greater than local version"
  START=$(echo "${LOCALVER} + 1" | /usr/bin/bc -l)
  /usr/bin/ssh jacques@hostname /usr/local/bin/svnadmin dump --incremental --deltas --revision ${START}:${REMOTEVER} /path/to/repo | /usr/local/bin/svnadmin load --ignore-uuid /path/to/repo
else
  echo "Both local and remote version have the same data"
fi

? Earlier 2 items total Later ?