X-Git-Url: https://git.stderr.nl/gitweb?p=matthijs%2Fupstream%2Fbackupninja.git;a=blobdiff_plain;f=handlers%2Fmysql.in;h=e34b16dbb0c3c3d697d9ac0152079f70a53a1b79;hp=64b6f492188b31429ceb9249abd9c748fd68d99c;hb=94861df686d7083675af42890ececb70cb108b67;hpb=3cf6de437495495ea400ade55f7b13d4077b8cb3 diff --git a/handlers/mysql.in b/handlers/mysql.in index 64b6f49..e34b16d 100644 --- a/handlers/mysql.in +++ b/handlers/mysql.in @@ -10,6 +10,7 @@ getconf nodata getconf dbhost localhost getconf hotcopy no getconf sqldump no +getconf sqldumpoptions "--lock-tables --complete-insert --add-drop-table --quick --quote-names" getconf compress yes getconf vsname @@ -31,10 +32,7 @@ if [ $vservers_are_available = yes ]; then fatal "The vserver given in vsname ($vsname) does not exist." fi # is it running ? - $VSERVERINFO -q $vsname RUNNING - if [ $? -ne 0 ]; then - fatal "The vserver $vsname is not running." - fi + vservers_running $vsname || fatal "The vserver $vsname is not running." # everything ok info "Using vserver '$vsname'." usevserver=yes @@ -238,7 +236,7 @@ then fatal "Authentication problem, maybe user/password is wrong or mysqld is not running?" fi else - databases=`echo 'show databases' | su $user -c "$MYSQL $defaultsfile" | grep -v Database` + databases=$(su $user -c "$MYSQL $defaultsfile -N -B -e 'show databases'" | sed 's/|//g;/\+----/d') if [ $? -ne 0 ] then fatal "Authentication problem, maybe user/password is wrong or mysqld is not running?" @@ -248,7 +246,7 @@ then for db in $databases do - DUMP_BASE="$MYSQLDUMP $defaultsfile --lock-tables --complete-insert --add-drop-table --quick --quote-names" + DUMP_BASE="$MYSQLDUMP $defaultsfile $sqldumpoptions" # Dumping structure and data DUMP="$DUMP_BASE $ignore $db" @@ -268,9 +266,9 @@ then if [ $usevserver = yes ] then # Test to make sure mysqld is running, if it is not sqldump will not work - $VSERVER $vsname exec su $user -c "$MYSQLADMIN $defaultsfile ping" + $VSERVER $vsname exec su $user -c "$MYSQLADMIN $defaultsfile ping 2>&1 >/dev/null" if [ $? -ne 0 ]; then - fatal "Either you have an authentication problem, or mysqld doesn't appear to be running!" + fatal "mysqld doesn't appear to be running!" fi if [ "$compress" == "yes" ]; then execstr="$VSERVER $vsname exec $DUMP | $GZIP > $vroot$dumpdir/${db}.sql.gz" @@ -279,9 +277,9 @@ then fi else # Test to make sure mysqld is running, if it is not sqldump will not work - su $user -c "$MYSQLADMIN $defaultsfile ping" + su $user -c "$MYSQLADMIN $defaultsfile ping 2>&1 >/dev/null" if [ $? -ne 0 ]; then - fatal "Either you have an authentication problem, or mysqld doesn't appear to be running!" + fatal "mysqld doesn't appear to be running!" fi if [ "$compress" == "yes" ]; then execstr="$DUMP | $GZIP > $dumpdir/${db}.sql.gz"