Beispiel #1
0
        public override BackupTaskResult CreateNewBackup()
        {
            var(dumpfile, cmdOptions) = GenerateOptionsToCommand();
            var dumpTgzFileName  = dumpfile + ".tar.gz";
            var processStartInfo = new ProcessStartInfo("bash", $"-c \"{PathToMssqlDump} {cmdOptions} \"")
            {
                RedirectStandardOutput = true,
                UseShellExecute        = false,
                CreateNoWindow         = true
            };

            var process = new Process {
                StartInfo = processStartInfo
            };

            process.Start();
            process.WaitForExit();
            var code = process.ExitCode;

            Utils.CreateTarGZ(new List <string> {
                dumpfile,
            }, dumpTgzFileName);

            Log.Information($"{Database} backup completed. dump files : {dumpTgzFileName}");

            var result = new BackupTaskResult
            {
                Result    = true,
                FilesList = new List <string> {
                    dumpTgzFileName
                },
            };

            return(result);
        }
Beispiel #2
0
        public override BackupTaskResult CreateNewBackup()
        {
            var(backupFile, cmdOptions) = GenerateOptionsToCommand();

            var processStartInfo = new ProcessStartInfo("bash", $"-c \"{PathToPgDump}  {cmdOptions} \"")
            {
                RedirectStandardOutput = true,
                UseShellExecute        = false,
                CreateNoWindow         = true
            };

            processStartInfo.Environment.Add("PGPASSWORD", Password);
            var process = new Process {
                StartInfo = processStartInfo
            };

            process.Start();

            process.WaitForExit();
            var code = process.ExitCode;

            Log.Information($"{Database} backup completed. dump files : {backupFile}");

            var result = new BackupTaskResult
            {
                Result    = true,
                FilesList = new List <string> {
                    backupFile
                },
            };

            return(result);
        }