From 036db2ee35b7d9afa4d3a06bd2c80382b7d1443b Mon Sep 17 00:00:00 2001 From: micah Date: Tue, 27 Dec 2005 17:35:54 +0000 Subject: [PATCH] r211@um: micah | 2005-12-27 09:09:54 -0500 Added some vserver handling to determine correct home directory, also enhanced error handling git-svn-id: http://code.autistici.org/svn/backupninja/trunk@272 758a04ac-41e6-0310-8a23-8373a73cc35d --- handlers/mysql | 42 ++++++++++++++++++++++++++++-------------- 1 file changed, 28 insertions(+), 14 deletions(-) diff --git a/handlers/mysql b/handlers/mysql index cd2d491..965b05e 100644 --- a/handlers/mysql +++ b/handlers/mysql @@ -63,7 +63,7 @@ then fi fi -# create backup dirs, the vroot variable will be empty if no vsname was specified +# create backup dirs, vroot variable will be empty if no vsname was specified # and will proceed to operate on the host [ -d $vroot$backupdir ] || mkdir -p $vroot$backupdir [ -d $vroot$backupdir ] || fatal "Backup directory '$vroot$backupdir'" @@ -97,19 +97,25 @@ fi # specify the password on the command line. defaultsfile="" -if [ "$dbusername" != "" -a "$dbpassword" != "" ]; then - home=`getent passwd "root" | awk -F: '{print $6}'` - [ -d $home ] || fatal "Can't find root's home directory ($home)." - mycnf="$home/.my.cnf" - if [ -f $mycnf ]; then - # rename temporarily - tmpcnf="$home/my.cnf.disable" - debug "mv $mycnf $tmpcnf" - mv $mycnf $tmpcnf - fi - oldmask=`umask` - umask 077 - cat > $mycnf < $mycnf <