projects
/
matthijs
/
upstream
/
backupninja.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fixes for mysql handler for mysqld inside a vserver
[matthijs/upstream/backupninja.git]
/
handlers
/
mysql.in
diff --git
a/handlers/mysql.in
b/handlers/mysql.in
index fe1e7832f32ee43c090cf5e17d6e985e040f8376..6e894fee967d19a864e034e6bc5ba0fb48a25fda 100644
(file)
--- a/
handlers/mysql.in
+++ b/
handlers/mysql.in
@@
-88,8
+88,7
@@
if [ "$dbusername" != "" -a "$dbpassword" != "" ]
then
if [ $usevserver = yes ]
then
then
if [ $usevserver = yes ]
then
- vhome=`$VSERVER $vsname exec getent passwd "root" | @AWK@ -F: '{print $6}'`
- home="$vroot$vhome"
+ home=`$VSERVER $vsname exec getent passwd "root" | @AWK@ -F: '{print $6}'`
else
home=`getent passwd "root" | @AWK@ -F: '{print $6}'`
fi
else
home=`getent passwd "root" | @AWK@ -F: '{print $6}'`
fi
@@
-97,18
+96,25
@@
then
[ -d $home ] || fatal "Can't find root's home directory ($home)."
mycnf="$home/.my.cnf"
[ -d $home ] || fatal "Can't find root's home directory ($home)."
mycnf="$home/.my.cnf"
-
- if [ -f $mycnf ]
+
+ if [ $usevserver = yes ]
+ then
+ workcnf="$vroot$mycnf"
+ else
+ workcnf="$mycnf"
+ fi
+
+ if [ -f $workcnf ]
then
then
-
# rename temporarily
-
tmpcnf="$home/my.
cnf.disable"
-
debug "mv $my
cnf $tmpcnf"
-
mv $my
cnf $tmpcnf
+ # rename temporarily
+
tmpcnf="$work
cnf.disable"
+
debug "mv $work
cnf $tmpcnf"
+
mv $work
cnf $tmpcnf
fi
oldmask=`umask`
umask 077
fi
oldmask=`umask`
umask 077
- cat > $
my
cnf <<EOF
+ cat > $
work
cnf <<EOF
# auto generated backupninja mysql conf
[mysql]
host=$dbhost
# auto generated backupninja mysql conf
[mysql]
host=$dbhost
@@
-124,14
+130,14
@@
password="$dbpassword"
host=$dbhost
user=$dbusername
password="$dbpassword"
host=$dbhost
user=$dbusername
password="$dbpassword"
+
+[mysqladmin]
+host=$dbhost
+user=$dbusername
+password="$dbpassword"
EOF
umask $oldmask
EOF
umask $oldmask
- if [ $usevserver = yes ]
- then
- defaultsfile="--defaults-extra-file=$vhome/.my.cnf"
- else
- defaultsfile="--defaults-extra-file=$mycnf"
- fi
+ defaultsfile="--defaults-extra-file=$mycnf"
fi
# if a user is not set, use $configfile, otherwise use $mycnf
fi
# if a user is not set, use $configfile, otherwise use $mycnf
@@
-142,22
+148,23
@@
else
userset=true;
if [ $usevserver = yes ]
then
userset=true;
if [ $usevserver = yes ]
then
-
v
userhome=`$VSERVER $vsname exec getent passwd "$user" | @AWK@ -F: '{print $6}'`
+ userhome=`$VSERVER $vsname exec getent passwd "$user" | @AWK@ -F: '{print $6}'`
if [ $? -eq 2 ]
then
fatal "User $user not found in /etc/passwd"
fi
if [ $? -eq 2 ]
then
fatal "User $user not found in /etc/passwd"
fi
- userhome="$vroot$vuserhome"
+ debug "User home set to: $vroot$userhome"
+ [ -f $vroot$userhome/.my.cnf ] || fatal "Can't find config file in $userhome/.my.cnf"
else
userhome=`getent passwd "$user" | @AWK@ -F: '{print $6}'`
if [ $? -eq 2 ]
then
fatal "User $user not found in /etc/passwd"
fi
else
userhome=`getent passwd "$user" | @AWK@ -F: '{print $6}'`
if [ $? -eq 2 ]
then
fatal "User $user not found in /etc/passwd"
fi
- fi
+ debug "User home set to: $userhome"
+ [ -f $userhome/.my.cnf ] || fatal "Can't find config file in $userhome/.my.cnf"
+ fi
- 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"
debug "using $defaultsfile"
fi
defaultsfile="--defaults-extra-file=$userhome/.my.cnf"
debug "using $defaultsfile"
fi
@@
-307,12
+314,12
@@
fi
if [ "$dbusername" != "" -a "$dbpassword" != "" ]
then
## clean up tmp config file
if [ "$dbusername" != "" -a "$dbpassword" != "" ]
then
## clean up tmp config file
- debug "rm $
my
cnf"
- rm $
my
cnf
+ debug "rm $
work
cnf"
+ rm $
work
cnf
if [ -f "$tmpcnf" ]
then
if [ -f "$tmpcnf" ]
then
- debug "mv $tmpcnf $
my
cnf"
- mv $tmpcnf $
my
cnf
+ debug "mv $tmpcnf $
work
cnf"
+ mv $tmpcnf $
work
cnf
fi
fi
fi
fi