2017-09-27 13:57:10 +00:00
|
|
|
|
using MongoDB.Driver;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Diagnostics;
|
|
|
|
|
using System.IO;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using Newtonsoft.Json;
|
|
|
|
|
using System.IO.Compression;
|
|
|
|
|
|
|
|
|
|
namespace BuechermarktClient
|
|
|
|
|
{
|
|
|
|
|
public class Backup
|
|
|
|
|
{
|
|
|
|
|
public static void MakeBackup() {
|
|
|
|
|
|
|
|
|
|
var ts = (Int32)(DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1))).TotalSeconds;
|
|
|
|
|
var process = new Process();
|
|
|
|
|
process.StartInfo.FileName = ".\\mongodump.exe";
|
|
|
|
|
process.StartInfo.Arguments = "--host " + MainWindow.MongoHost + " --db " + MainWindow.DatabaseName + " --gzip --out .\\backups\\" + ts;
|
|
|
|
|
process.StartInfo.RedirectStandardOutput = true;
|
|
|
|
|
process.StartInfo.UseShellExecute = false;
|
|
|
|
|
process.StartInfo.CreateNoWindow = true;
|
|
|
|
|
process.Start();
|
|
|
|
|
}
|
|
|
|
|
}
|
2017-05-18 10:57:50 +00:00
|
|
|
|
}
|