1
This commit is contained in:
@@ -9,7 +9,7 @@ Feature rich MySQL / MariaDB backup script.
|
|||||||
|
|
||||||
## Example
|
## Example
|
||||||
|
|
||||||
**Usage:** `mysql_backup.sh -d /backup/dir/ -n daily [-c 10 -s -a -e test@domain.org]`
|
**Usage:** `mysql_backup.sh -d /backup/dir/ -n daily [-c 10 -s -z -e test@domain.org]`
|
||||||
|
|
||||||
## Options
|
## Options
|
||||||
|
|
||||||
@@ -30,7 +30,7 @@ compress dump using gzip
|
|||||||
|
|
||||||
## Setup script in crontab
|
## Setup script in crontab
|
||||||
|
|
||||||
`20 01 * * * root /bin/sh /path/to/mysql_backup.sh -d /backup/dir/ -n daily -c 10 -e admin@email.com -a`
|
`20 01 * * * root /bin/sh /path/to/mysql_backup.sh -d /backup/dir/ -n daily -c 10 -e admin@email.com -z`
|
||||||
|
|
||||||
## .my.cnf example
|
## .my.cnf example
|
||||||
|
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ while [ "$1" != "" ]; do
|
|||||||
-s | --single-transaction )
|
-s | --single-transaction )
|
||||||
singletrans=1
|
singletrans=1
|
||||||
;;
|
;;
|
||||||
-z | --compress ) archive=1
|
-z | --compress ) compress=1
|
||||||
;;
|
;;
|
||||||
-q | --quiet ) quiet=1
|
-q | --quiet ) quiet=1
|
||||||
;;
|
;;
|
||||||
@@ -152,10 +152,10 @@ dump_file_name="${dir}/mysqldump.${name}.${date}.sql" ;
|
|||||||
|
|
||||||
mysqldump ${mysqlparams} > ${dump_file_name} ;
|
mysqldump ${mysqlparams} > ${dump_file_name} ;
|
||||||
|
|
||||||
if [ "${archive}" ] ; then
|
if [ "${compress}" ] ; then
|
||||||
|
|
||||||
if [ ! "${quiet}" ] ; then
|
if [ ! "${quiet}" ] ; then
|
||||||
echo "Archiving dump (`date +\"%Y-%m-%d %H:%M:%S\"`)..." ;
|
echo "Compressing dump (`date +\"%Y-%m-%d %H:%M:%S\"`)..." ;
|
||||||
fi
|
fi
|
||||||
|
|
||||||
gzip ${dump_file_name} ;
|
gzip ${dump_file_name} ;
|
||||||
|
|||||||
Reference in New Issue
Block a user