source: tools/mysqlbackup.sh@ 322

Last change on this file since 322 was 216, checked in by Rick van der Zwet, 14 years ago

Por mans configuration backup

  • Property svn:executable set to *
  • Property svn:keywords set to Id
File size: 556 bytes
Line 
1#!/bin/sh
2#
3# $Id: mysqlbackup.sh 216 2010-11-06 16:38:30Z rick $
4# Poor mans mysql database backup.
5# Rick van der Zwet <info@rickvanderzwet.nl>
6
7
8BACKUP_ROOT='/usr/local/backup/mysqlbackup'
9MYSQL_AUTH='-uroot'
10export PATH=$PATH:/usr/local/bin
11
12# All available database
13DATABASES=`echo 'show databases' | mysql --skip-column-names $MYSQL_AUTH`
14
15BACKUP_TODAY=`date "+$BACKUP_ROOT/%Y/%m/%d/"`
16mkdir -p $BACKUP_TODAY
17# Dump and compress
18for DATABASE in $DATABASES; do
19 TIMETAG=`date "+%H:%M:%S"`
20 mysqldump $MYSQL_AUTH --skip-lock-tables $DATABASE | gzip > $BACKUP_TODAY/$DATABASE-$TIMETAG.sql.gz
21done
22
Note: See TracBrowser for help on using the repository browser.