Created
August 6, 2014 13:42
-
-
Save a2f0/f22b381ab71c4ac4576c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
p = subprocess.Popen(["mysqldump", "--single-transaction", "-u", | |
database_username, "--password="+database_password, "--databases", | |
"--host", server_address, database_name, ], | |
stdout = open( outputfile, 'w') , stderr=subprocess.PIPE) | |
error = p.stderr.read() | |
p_ret = p.wait() | |
print "return code from mysqldump: " + str(p_ret) | |
if (len(error)) > 0: | |
action_error(error) | |
sys.exit(-1) | |
if (compress == "1"): | |
p2 = subprocess.Popen(["tar", "-C", backup_destination, | |
"--remove-files", "--force-local", "-czf", gzipoutputfile, | |
mysqlfilename ], stderr=subprocess.PIPE) | |
error2 = p2.stderr.read() | |
p2.wait() | |
if (len(error2)) > 0: | |
action_error(error2) | |
sys.exit(-1) | |
action_success() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment