# 1. setting the user, so that /home/user/.my.cnf is used.
# 2. specifying the user and password in the handler config,
# which generates a temporary .my.cnf in /root/.my.cnf
-# 3. specify the config file with --defaults-file
+# 3. specify the config file with --defaults-extra-file
# (this option DOESN'T WORK WITH MYSQLHOTCOPY)
#
umask $oldmask
if [ $usevserver = yes ]
then
- defaultsfile="--defaults-file=$vhome/.my.cnf"
+ defaultsfile="--defaults-extra-file=$vhome/.my.cnf"
else
- defaultsfile="--defaults-file=$mycnf"
+ defaultsfile="--defaults-extra-file=$mycnf"
fi
fi
# if a user is not set, use $configfile, otherwise use $mycnf
if [ "$user" == "" ]; then
user=root;
- defaultsfile="--defaults-file=$configfile"
+ defaultsfile="--defaults-extra-file=$configfile"
else
userset=true;
if [ $usevserver = yes ]
debug "User home set to: $userhome"
[ -f $userhome/.my.cnf ] || fatal "Can't find config file in $userhome/.my.cnf"
- defaultsfile="--defaults-file=$userhome/.my.cnf"
+ defaultsfile="--defaults-extra-file=$userhome/.my.cnf"
debug "using $defaultsfile"
fi
else
execstr="$MYSQLHOTCOPY --quiet --allowold --regexp /.\*/./.\*/ $hotdir"
fi
- debug 'su $user -c \"$execstr\"'
+ debug "su $user -c \"$execstr\""
if [ ! $test ]
then
- output=`su $user -c \"$execstr\" 2>&1`
+ output=`su $user -c "$execstr" 2>&1`
code=$?
if [ "$code" == "0" ]
then
debug 'su $user -c \"$execstr\"'
if [ ! $test ]
then
- output=`su $user -c \"$execstr\" 2>&1`
+ output=`su $user -c "$execstr" 2>&1`
code=$?
if [ "$code" == "0" ]
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`
+ databases=`echo 'show databases' | $VSERVER $vsname exec su $user -c "$MYSQL $defaultsfile" | grep -v Database`
if [ $? -ne 0 ]
then
fatal "Authentication problem, maybe user/password is wrong"
fi
else
- databases=`echo 'show databases' | su $user -c \"$MYSQL $defaultsfile\" | grep -v Database`
+ databases=`echo 'show databases' | su $user -c "$MYSQL $defaultsfile" | grep -v Database`
if [ $? -ne 0 ]
then
fatal "Authentication problem, maybe user/password is wrong"
do
if [ $usevserver = yes ]
then
- execstr="$VSERVER $vsname exec $MYSQLDUMP $defaultsfile --lock-tables --complete-insert --add-drop-table --quick --quote-names $ignore $db > $vroot$dumpdir/${db}.sql"
+ if [ "$compress" == "yes" ]; then
+ execstr="$VSERVER $vsname exec $MYSQLDUMP $defaultsfile --lock-tables --complete-insert --add-drop-table --quick --quote-names $ignore $db | $GZIP > $vroot$dumpdir/${db}.sql.gz"
+ else
+ execstr="$VSERVER $vsname exec $MYSQLDUMP $defaultsfile --lock-tables --complete-insert --add-drop-table --quick --quote-names $ignore $db > $vroot$dumpdir/${db}.sql"
+ fi
else
- execstr="$MYSQLDUMP $defaultsfile --lock-tables --complete-insert --add-drop-table --quick --quote-names $ignore $db > $dumpdir/${db}.sql"
+ if [ "$compress" == "yes" ]; then
+ execstr="$MYSQLDUMP $defaultsfile --lock-tables --complete-insert --add-drop-table --quick --quote-names $ignore $db | $GZIP > $dumpdir/${db}.sql.gz"
+ else
+ execstr="$MYSQLDUMP $defaultsfile --lock-tables --complete-insert --add-drop-table --quick --quote-names $ignore $db > $dumpdir/${db}.sql"
+ fi
fi
- debug 'su $user -c \"$execstr\"'
+ debug "su $user -c \"$execstr\""
if [ ! $test ]
then
- output=`su $user -c \"$execstr\" 2>&1`
+ output=`su $user -c "$execstr" 2>&1`
code=$?
if [ "$code" == "0" ]
then
fi
fi
done
-
- if [ "$compress" == "yes" ]
- then
- output=`$GZIP -f $vroot$dumpdir/*.sql 2>&1`
- debug $output
- fi
fi
# clean up tmp config file