X-Git-Url: https://git.stderr.nl/gitweb?p=matthijs%2Fupstream%2Fbackupninja.git;a=blobdiff_plain;f=handlers%2Fmysql.in;h=3488c511becd6ecd8f247d4f2f476f9303d2fcbd;hp=0aa3abbc9f4c5fb2d926d9f7ef41d5d6db8cdf6f;hb=47313bca65de105145f2168538b294a9bcc0e98d;hpb=f4ab3148f175f8ac415b01fea61d14a80f4de969 diff --git a/handlers/mysql.in b/handlers/mysql.in index 0aa3abb..3488c51 100644 --- a/handlers/mysql.in +++ b/handlers/mysql.in @@ -90,27 +90,33 @@ if [ "$dbusername" != "" -a "$dbpassword" != "" ] 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 [ -d $home ] || fatal "Can't find root's home directory ($home)." - + mycnf="$home/.my.cnf" - if [ -f $mycnf ] + if [ $usevserver = yes ] then - # rename temporarily - tmpcnf="$home/my.cnf.disable" - debug "mv $mycnf $tmpcnf" - mv $mycnf $tmpcnf + workcnf="$vroot$mycnf" + else + workcnf="$mycnf" fi + if [ -f $workcnf ] + then + # rename temporarily + tmpcnf="$workcnf.disable" + debug "mv $workcnf $tmpcnf" + mv $workcnf $tmpcnf + fi + oldmask=`umask` umask 077 - cat > $mycnf < $workcnf <&1` + output=`su $user -c "set -o pipefail ; $execstr" 2>&1` code=$? if [ "$code" == "0" ] then @@ -309,12 +316,12 @@ fi if [ "$dbusername" != "" -a "$dbpassword" != "" ] then ## clean up tmp config file - debug "rm $mycnf" - rm $mycnf + debug "rm $workcnf" + rm $workcnf if [ -f "$tmpcnf" ] then - debug "mv $tmpcnf $mycnf" - mv $tmpcnf $mycnf + debug "mv $tmpcnf $workcnf" + mv $tmpcnf $workcnf fi fi