Last change
on this file since 286 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
|
Rev | Line | |
---|
[215] | 1 | #!/bin/sh
|
---|
| 2 | #
|
---|
[216] | 3 | # $Id: mysqlbackup.sh 216 2010-11-06 16:38:30Z rick $
|
---|
[215] | 4 | # Poor mans mysql database backup.
|
---|
| 5 | # Rick van der Zwet <info@rickvanderzwet.nl>
|
---|
| 6 |
|
---|
| 7 |
|
---|
| 8 | BACKUP_ROOT='/usr/local/backup/mysqlbackup'
|
---|
| 9 | MYSQL_AUTH='-uroot'
|
---|
| 10 | export PATH=$PATH:/usr/local/bin
|
---|
| 11 |
|
---|
| 12 | # All available database
|
---|
| 13 | DATABASES=`echo 'show databases' | mysql --skip-column-names $MYSQL_AUTH`
|
---|
| 14 |
|
---|
| 15 | BACKUP_TODAY=`date "+$BACKUP_ROOT/%Y/%m/%d/"`
|
---|
| 16 | mkdir -p $BACKUP_TODAY
|
---|
| 17 | # Dump and compress
|
---|
| 18 | for 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
|
---|
| 21 | done
|
---|
| 22 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.