static void Main(string[] args) { if (args.Length < 2) { Console.WriteLine("Failure, missing arguments."); Console.WriteLine("galaxyBackup.exe <galaxyname> <path>"); return; } string nodeName = Environment.MachineName; GRAccessApp grAccess = new GRAccessAppClass(); IGalaxies gals = grAccess.QueryGalaxies(nodeName); if (gals == null || grAccess.CommandResult.Successful == false) { Console.WriteLine(grAccess.CommandResult.CustomMessage + grAccess.CommandResult.Text); return; } IGalaxy galaxy = gals[args[0]]; if (galaxy == null) { Console.WriteLine("Failure, galaxy '{0}' does not exist", args[0]); return; } Process currentProc = Process.GetCurrentProcess(); galaxy.Backup(currentProc.Id, args[1], nodeName, args[0]); }
/// <summary> /// Perform a complete backup generating a CAB /// </summary> /// <returns></returns> public int BackupCompleteCAB(String BackupFileName) { int ProcessId; try { // first verify connection if (!this.Connected) { throw new Exception("Galaxy not connected"); } log.Debug("Checking and correcting filename " + BackupFileName + " to use .CAB"); // Inspect the filename. Correct the extension if necessary BackupFileName = System.IO.Path.ChangeExtension(BackupFileName, ".CAB"); // Check for file exists. Bail if the file already exists and we don't want to overwrite if (CheckandLogFileExists(BackupFileName)) { return(0); } // Get the current PID ProcessId = System.Diagnostics.Process.GetCurrentProcess().Id; log.Debug("Got Process ID " + ProcessId.ToString()); if (ProcessId == 0) { log.Error("Inavlid ProcessID"); return(-2); } var obj = _galaxy.GetGalaxyConfiguration(); log.Info("Starting CAB Backup to " + BackupFileName); // Call complete backup routine _galaxy.Backup(ProcessId, BackupFileName, this.GRNodeName, _galaxy.Name); if (_galaxy.CommandResult.Successful) { log.Info("Backup CAB Complete"); return(0); } else { log.Error(_galaxy.CommandResult.Text); return(-1); } } catch (Exception ex) { throw ex; } }