X-Git-Url: https://git.stderr.nl/gitweb?p=matthijs%2Fupstream%2Fbackupninja.git;a=blobdiff_plain;f=handlers%2Fmysql.in;h=3488c511becd6ecd8f247d4f2f476f9303d2fcbd;hp=88ffb1a798fa8d9eec8e1d8587aa439fd4b5768c;hb=47313bca65de105145f2168538b294a9bcc0e98d;hpb=78884142e7cdaaf3e1f5571b1f28d2ea5a520b30 diff --git a/handlers/mysql.in b/handlers/mysql.in index 88ffb1a..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