added xz compress option
This commit is contained in:
@@ -26,8 +26,10 @@ lock all tables across all databases. This is achieved by acquiring a global rea
|
|||||||
WARNING!!! This will block all applications.
|
WARNING!!! This will block all applications.
|
||||||
**-s, --single-transaction**
|
**-s, --single-transaction**
|
||||||
this option sets the transaction isolation mode to REPEATABLE READ and sends a START TRANSACTION SQL statement to the server before dumping data. It is useful only with transactional tables such as InnoDB, because then it dumps the consistent state of the database at the time when START TRANSACTION was issued without blocking any applications.
|
this option sets the transaction isolation mode to REPEATABLE READ and sends a START TRANSACTION SQL statement to the server before dumping data. It is useful only with transactional tables such as InnoDB, because then it dumps the consistent state of the database at the time when START TRANSACTION was issued without blocking any applications.
|
||||||
**-z, --compress**
|
**-z, --gzip**
|
||||||
compress dump using gzip
|
compress dump using gzip
|
||||||
|
**-x, --xz**
|
||||||
|
compress dump using xz
|
||||||
**-m, --master**
|
**-m, --master**
|
||||||
set master data in dump
|
set master data in dump
|
||||||
**-q, --quiet**
|
**-q, --quiet**
|
||||||
|
|||||||
@@ -15,7 +15,8 @@ usage()
|
|||||||
echo "-e | --email :: notification email"
|
echo "-e | --email :: notification email"
|
||||||
echo "-l | --lock-all-tables"
|
echo "-l | --lock-all-tables"
|
||||||
echo "-s | --single-transaction"
|
echo "-s | --single-transaction"
|
||||||
echo "-z | --compress :: gzip dump"
|
echo "-z | --gzip :: compress dump using gzip"
|
||||||
|
echo "-x | --xz :: compress dump using xz"
|
||||||
echo "-m | --master :: set master data"
|
echo "-m | --master :: set master data"
|
||||||
echo "-q | --quiet :: silent mode"
|
echo "-q | --quiet :: silent mode"
|
||||||
echo "-h | --help :: display this help"
|
echo "-h | --help :: display this help"
|
||||||
@@ -50,7 +51,9 @@ while [ "${1}" != "" ]; do
|
|||||||
-s | --single-transaction )
|
-s | --single-transaction )
|
||||||
singletrans=1
|
singletrans=1
|
||||||
;;
|
;;
|
||||||
-z | --compress ) compress=1
|
-z | --gzip ) gzip=1
|
||||||
|
;;
|
||||||
|
-x | --xz ) xz=1
|
||||||
;;
|
;;
|
||||||
-m | --master ) master=1
|
-m | --master ) master=1
|
||||||
-q | --quiet ) quiet=1
|
-q | --quiet ) quiet=1
|
||||||
@@ -105,6 +108,7 @@ mysqlparams=" --all-databases \
|
|||||||
--comments \
|
--comments \
|
||||||
--quick \
|
--quick \
|
||||||
--force \
|
--force \
|
||||||
|
--ignore-table=mysql.proc
|
||||||
--log-error=/var/log/mysqldump.log" ;
|
--log-error=/var/log/mysqldump.log" ;
|
||||||
|
|
||||||
if [ "${singletrans}" ] ; then
|
if [ "${singletrans}" ] ; then
|
||||||
@@ -142,17 +146,26 @@ dump_file_name="${dir}/${prefix}.${date}.sql" ;
|
|||||||
|
|
||||||
mysqldump ${mysqlparams} > ${dump_file_name} ;
|
mysqldump ${mysqlparams} > ${dump_file_name} ;
|
||||||
|
|
||||||
if [ "${compress}" ] ; then
|
if [ "${gzip}" ] ; then
|
||||||
|
|
||||||
if [ ! "${quiet}" ] ; then
|
if [ ! "${quiet}" ] ; then
|
||||||
echo "Compressing dump (`date +\"%H:%M:%S\"`)..." ;
|
echo "Compressing dump by gzip (`date +\"%H:%M:%S\"`)..." ;
|
||||||
fi
|
fi
|
||||||
|
|
||||||
gzip ${dump_file_name} ;
|
gzip ${dump_file_name} ;
|
||||||
|
else
|
||||||
|
if [ "${xz}" ] ; than
|
||||||
|
|
||||||
|
if [ ! "${quiet}" ] ; then
|
||||||
|
echo "Compressing dump by xz (`date +\"%H:%M:%S\"`)..." ;
|
||||||
|
fi
|
||||||
|
|
||||||
|
xz ${dump_file_name} ;
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! "${quiet}" ] ; then
|
if [ ! "${quiet}" ] ; then
|
||||||
echo "atabase dump completed (`date +\"%H:%M:%S\"`)..." ;
|
echo "Dump completed (`date +\"%H:%M:%S\"`)..." ;
|
||||||
fi
|
fi
|
||||||
|
|
||||||
rm -f ${mypidfile} ;
|
rm -f ${mypidfile} ;
|
||||||
|
|||||||
Reference in New Issue
Block a user