|
@@ -29,6 +29,22 @@ class EjabberdTask:
|
|
|
else:
|
|
|
os.remove(tempfname)
|
|
|
|
|
|
+class MysqlDumpTask:
|
|
|
+ def __init__(self, outputPath):
|
|
|
+ self.outputPath = outputPath
|
|
|
+ def is_supported(self):
|
|
|
+ return shutil.which('mysqldump') != None
|
|
|
+ def run(self):
|
|
|
+ query = 'show databases'
|
|
|
+ comOut = subprocess.check_output(['mysql','-e',query])
|
|
|
+ dbs = comOut.decode('utf-8').strip("\n ").split("\n")[1:]
|
|
|
+ # Exclude schema related databases
|
|
|
+ dbs = set(dbs) - {'information_schema', 'performance_schema'}
|
|
|
+ for dbname in dbs:
|
|
|
+ tempfname = os.path.join(self.outputPath, 'mysql_%s.sql' % dbname)
|
|
|
+ tempfh = open(tempfname, mode='w')
|
|
|
+ subprocess.call(['mysqldump','--databases',dbname], stdout=tempfh)
|
|
|
+
|
|
|
class PgDumpTask:
|
|
|
def __init__(self, outputPath, excludeDatname):
|
|
|
self.outputPath = outputPath
|
|
@@ -101,6 +117,7 @@ else:
|
|
|
# Run software-specific backup tasks
|
|
|
tasks = []
|
|
|
tasks.append(EjabberdTask(backupTemp))
|
|
|
+tasks.append(MysqlDumpTask(backupTemp))
|
|
|
tasks.append(PgDumpTask(backupTemp, pgsqlExcludeDatname))
|
|
|
|
|
|
for task in tasks:
|