From 3cb7e0dbd3a0e84a115f1d6c275877ede23d4c1a Mon Sep 17 00:00:00 2001 From: Naum Soloveychik Date: Sun, 12 Jan 2020 23:23:38 +0300 Subject: [PATCH] some fixes --- README.md | 4 ++-- mysql_backup.sh | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 000420d..df631ad 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,7 @@ compress dump using gzip **-x, --xz** compress dump using xz **--xz-threads** -number of worker threads to use by xz +number of worker threads to use by xz. 0 - use all CPU. (default: 2) **-m, --master** set master data in dump **-q, --quiet** @@ -45,7 +45,7 @@ set pid-file (default: /var/run/mysql_backup.sh.pid) ## 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 -z -q -m` +`20 01 * * * root /bin/sh /path/to/mysql_backup.sh -d /backup/dir/ -n daily -c 7 -e admin@email.com -x --xz-threads=6 -q -m` ## .my.cnf example diff --git a/mysql_backup.sh b/mysql_backup.sh index 01585f6..2796d44 100755 --- a/mysql_backup.sh +++ b/mysql_backup.sh @@ -7,17 +7,17 @@ pidfile="/var/run/`basename ${0}`.pid" ; usage() { - echo "Usage: mysql_backup.sh -d /var/backup -n daily [-c 10 -s -a -e test@domain.org]" + echo "Usage: mysql_backup.sh -d /var/backup -n daily [-c 10 -s -x --xz-threads=6 -e test@domain.org]" echo echo "-d | --dir :: backup directory" echo "-n | --name :: backup name" - echo "-c | --copies :: number of copies to store (default 10)" + echo "-c | --copies :: number of copies to store (default: 10)" echo "-e | --email :: notification email" echo "-l | --lock-all-tables" echo "-s | --single-transaction" echo "-z | --gzip :: compress dump using gzip" echo "-x | --xz :: compress dump using xz" - echo "--xz-threads :: xz threads (0 - all CPUs)" + echo "--xz-threads :: number of worker threads to use by xz. 0 - use all CPU. (default: 2)" echo "-m | --master :: set master data" echo "-q | --quiet :: silent mode" echo "--pid-file :: pid file default ${pidfile}" @@ -80,7 +80,7 @@ then copies=10 fi -if [ "${xz_threads}" = "" ] || [ ! -n "${xz_threads}" ] || [ "${xz_threads}" -le "0" ] ; +if [ "${xz_threads}" = "" ] || [ ! -n "${xz_threads}" ] || [ "${xz_threads}" -lt "0" ] ; then xz_threads=2 fi