aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Austein <sra@hactrn.net>2014-02-20 15:02:02 +0000
committerRob Austein <sra@hactrn.net>2014-02-20 15:02:02 +0000
commitac0c358f4358b8a421db09f815ee75d1c0d3e4bd (patch)
treedc96af3d21357c7025fb87d3d0a6cf0fc7ac6ab9
parent065c44e912a7fca14ae641a09aa89d0a573c3cdf (diff)
Pull from trunk.
svn path=/branches/tk671/; revision=5675
-rwxr-xr-xrpkid/rpki-sql-backup8
1 files changed, 5 insertions, 3 deletions
diff --git a/rpkid/rpki-sql-backup b/rpkid/rpki-sql-backup
index 0d788ffd..f90ee1e8 100755
--- a/rpkid/rpki-sql-backup
+++ b/rpkid/rpki-sql-backup
@@ -21,8 +21,6 @@
"""
Back up data from SQL databases, looking at config file to figure out
which databases and what credentials to use with them.
-
-For the moment, this just writes all the SQL to stdout.
"""
import subprocess
@@ -38,6 +36,9 @@ time.tzset()
parser = argparse.ArgumentParser(description = __doc__)
parser.add_argument("-c", "--config",
help = "override default location of configuration file")
+parser.add_argument("-o", "--output",
+ type = argparse.FileType("wb"), default = sys.stdout,
+ help = "destination for SQL dump (default: stdout)")
args = parser.parse_args()
cfg = rpki.config.parser(args.config, "myrpki")
@@ -47,7 +48,8 @@ def dump(section):
("mysqldump", "--add-drop-database",
"-u", cfg.get("sql-username", section = section),
"-p" + cfg.get("sql-password", section = section),
- "-B", cfg.get("sql-database", section = section)))
+ "-B", cfg.get("sql-database", section = section)),
+ stdout = args.output)
if cfg.getboolean("start_rpkid", False):
dump("irdbd")