projects
/
matthijs
/
upstream
/
backupninja-vserver.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
mysql: pass options consistently when listing databases.
[matthijs/upstream/backupninja-vserver.git]
/
handlers
/
mysql.in
diff --git
a/handlers/mysql.in
b/handlers/mysql.in
index fe1e7832f32ee43c090cf5e17d6e985e040f8376..7ff194e924b1f6bf655d638efc24dc94bd948764 100644
(file)
--- a/
handlers/mysql.in
+++ b/
handlers/mysql.in
@@
-10,6
+10,7
@@
getconf nodata
getconf dbhost localhost
getconf hotcopy no
getconf sqldump no
getconf dbhost localhost
getconf hotcopy no
getconf sqldump no
+getconf sqldumpoptions "--lock-tables --complete-insert --add-drop-table --quick --quote-names"
getconf compress yes
getconf vsname
getconf compress yes
getconf vsname
@@
-39,6
+40,8
@@
if [ $vservers_are_available = yes ]; then
else
info "No vserver name specified, actions will be performed on the host."
fi
else
info "No vserver name specified, actions will be performed on the host."
fi
+else
+ [ -z "$vsname" ] || warning 'vservers support disabled in backupninja.conf, vsname configuration line will be ignored'
fi
## Prepare ignore part of the command
fi
## Prepare ignore part of the command
@@
-158,7
+161,11
@@
else
debug "User home set to: $userhome"
[ -f $userhome/.my.cnf ] || fatal "Can't find config file in $userhome/.my.cnf"
debug "User home set to: $userhome"
[ -f $userhome/.my.cnf ] || fatal "Can't find config file in $userhome/.my.cnf"
- defaultsfile="--defaults-extra-file=$userhome/.my.cnf"
+ if [ $usevserver = yes ]; then
+ defaultsfile="--defaults-extra-file=$vuserhome/.my.cnf"
+ else
+ defaultsfile="--defaults-extra-file=$userhome/.my.cnf"
+ fi
debug "using $defaultsfile"
fi
debug "using $defaultsfile"
fi
@@
-175,7
+182,7
@@
then
info "dbhost: $dbhost"
execstr="$VSERVER $vsname exec $MYSQLHOTCOPY -h $dbhost --quiet --allowold --regexp /.\*/./.\*/ $hotdir"
else
info "dbhost: $dbhost"
execstr="$VSERVER $vsname exec $MYSQLHOTCOPY -h $dbhost --quiet --allowold --regexp /.\*/./.\*/ $hotdir"
else
- execstr="$MYSQLHOTCOPY --quiet --allowold --regexp /.\*/./.\*/ $hotdir"
+ execstr="$MYSQLHOTCOPY -
h $dbhost -
-quiet --allowold --regexp /.\*/./.\*/ $hotdir"
fi
debug "su $user -c \"$execstr\""
if [ ! $test ]
fi
debug "su $user -c \"$execstr\""
if [ ! $test ]
@@
-196,9
+203,9
@@
then
do
if [ $usevserver = yes ]
then
do
if [ $usevserver = yes ]
then
- execstr="$VSERVER $vsname exec $MYSQLHOTCOPY --allowold $db $hotdir"
+ execstr="$VSERVER $vsname exec $MYSQLHOTCOPY -
h $dbhost -
-allowold $db $hotdir"
else
else
- execstr="$MYSQLHOTCOPY --allowold $db $hotdir"
+ execstr="$MYSQLHOTCOPY -
h $dbhost -
-allowold $db $hotdir"
fi
debug 'su $user -c \"$execstr\"'
if [ ! $test ]
fi
debug 'su $user -c \"$execstr\"'
if [ ! $test ]
@@
-228,8
+235,8
@@
then
then
if [ $usevserver = yes ]
then
then
if [ $usevserver = yes ]
then
- debug
'echo show databases | $VSERVER $vsname exec su $user -c \"$MYSQL $defaultsfile\" | grep -v Database'
- databases=`
echo 'show databases' | $VSERVER $vsname exec su $user -c "$MYSQL $defaultsfile" | grep -v Database
`
+ debug
"$VSERVER $vsname exec su $user -c \"$MYSQL $defaultsfile -N -B -e 'show databases'\" | sed 's/|//g;/\+----/d'"
+ databases=`
$VSERVER $vsname exec su $user -c "$MYSQL $defaultsfile -N -B -e 'show databases'" | sed 's/|//g;/\+----/d'
`
if [ $? -ne 0 ]
then
fatal "Authentication problem, maybe user/password is wrong or mysqld is not running?"
if [ $? -ne 0 ]
then
fatal "Authentication problem, maybe user/password is wrong or mysqld is not running?"
@@
-245,7
+252,7
@@
then
for db in $databases
do
for db in $databases
do
- DUMP_BASE="$MYSQLDUMP $defaultsfile
--lock-tables --complete-insert --add-drop-table --quick --quote-name
s"
+ DUMP_BASE="$MYSQLDUMP $defaultsfile
$sqldumpoption
s"
# Dumping structure and data
DUMP="$DUMP_BASE $ignore $db"
# Dumping structure and data
DUMP="$DUMP_BASE $ignore $db"