diff --git a/libtisbackup/backup_mysql.py b/libtisbackup/backup_mysql.py index 6a70d86..1890427 100644 --- a/libtisbackup/backup_mysql.py +++ b/libtisbackup/backup_mysql.py @@ -30,9 +30,6 @@ except ImportError,e: sys.stderr = sys.__stderr__ -import datetime -import base64 -import os from common import * class backup_mysql(backup_generic): @@ -69,10 +66,11 @@ class backup_mysql(backup_generic): self.ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) self.ssh.connect(self.server_name,username='root',pkey = mykey, port=self.ssh_port) + self.db_passwd=self.db_passwd.replace('$','\$') if not self.db_name: stats['log']= "Successfully backuping processed to the following databases :" stats['status']='List' - cmd = 'mysql -N -B -p -e "SHOW DATABASES;" -u ' + self.db_user +' -p' + self.db_passwd + cmd = 'mysql -N -B -p -e "SHOW DATABASES;" -u ' + self.db_user +' -p' + self.db_passwd + ' 2> /dev/null' self.logger.debug('[%s] List databases: %s',self.backup_name,cmd) (error_code,output) = ssh_exec(cmd,ssh=self.ssh) self.logger.debug("[%s] Output of %s :\n%s",self.backup_name,cmd,output) diff --git a/libtisbackup/backup_pgsql.py b/libtisbackup/backup_pgsql.py index 3f83c00..0848cb8 100644 --- a/libtisbackup/backup_pgsql.py +++ b/libtisbackup/backup_pgsql.py @@ -27,11 +27,6 @@ except ImportError,e: sys.stderr = sys.__stderr__ -import datetime -import base64 -import os -import logging -import re from common import * class backup_pgsql(backup_generic): @@ -70,7 +65,7 @@ class backup_pgsql(backup_generic): else: stats['log']= "Successfully backuping processed to the following databases :" stats['status']='List' - cmd = """su - postgres -c 'psql -t -c "SELECT datname FROM pg_database WHERE datistemplate = false;"'""" + cmd = """su - postgres -c 'psql -t -c "SELECT datname FROM pg_database WHERE datistemplate = false;"' 2> /dev/null""" self.logger.debug('[%s] List databases: %s',self.backup_name,cmd) (error_code,output) = ssh_exec(cmd,ssh=self.ssh) self.logger.debug("[%s] Output of %s :\n%s",self.backup_name,cmd,output)