rewrite of mysql backup script