2017-05-18 10:57:50 +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() {
|
|
|
|
|
|
2017-05-21 14:23:59 +00:00
|
|
|
|
var ts = (Int32)(DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1))).TotalSeconds;
|
|
|
|
|
var process = new Process();
|
2017-06-27 19:59:20 +00:00
|
|
|
|
process.StartInfo.FileName = ".\\mongodump.exe";
|
2017-05-21 14:23:59 +00:00
|
|
|
|
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
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|