static void Main(string[] args) { try { StartUpService startupService = new StartUpService(); _settings = startupService.GetSettings(); ShellCommands shellCommands = new ShellCommands(); Backup backup = new Backup(_settings); backup.CreateBackUp(); shellCommands.ExecuteShellCommand("mv", "/var/opt/mssql/data/AppDb.bak /var/data"); shellCommands.ExecuteShellCommand("chown", "jpayne0061 /var/data/AppDb.bak"); BlobServiceClient blobServiceClient = new BlobServiceClient(_settings.BlobConnString); var blobClient = blobServiceClient.GetBlobContainerClient("six-week-sql-db-backups"); FileStream uploadFileStream = File.OpenRead("/var/data/AppDb.bak"); blobClient.UploadBlob("AppDb" + DateTime.UtcNow.ToFileTimeUtc().ToString() + ".bak", uploadFileStream); } catch (Exception ex) { File.AppendAllText("dbBackUpLog", ex.StackTrace); throw; } }
private void MainFrame_Navigating(object sender, NavigatingCancelEventArgs e) { if (ContentFrame.Content != null) { ShellCommands.Clear(); MobileShellCommands.Clear(); } }
public void HideCommandBars(bool Hide) { if (Hide) { ShellCommands.HideItems(addLock: true); MobileShellCommands.HideItems(addLock: true); } else { ShellCommands.TryShowItems(unlock: true); MobileShellCommands.TryShowItems(unlock: true); } }
static void Main(string[] args) { #region dependencies Data data = new Data(new MemorySnapShotContext()); List <MemorySnapshot> memorySnapshots = new List <MemorySnapshot>(); ShellCommands shellCommandsService = new ShellCommands(); ParsingService parsingService = new ParsingService(); long currentInterval = 0; int tenSeconds = (int)TimeFromMsEnums.TenSeconds; #endregion dependencies while (true) { string unparsedMemory = shellCommandsService.ExecuteLinuxCommand("free", "-m"); MemorySnapshot ms = parsingService.ParseMemorySnapshot(unparsedMemory); if (ms != null) { memorySnapshots.Add(ms); } else { memorySnapshots.Add(new MemorySnapshot()); } if (currentInterval > (int)TimeFromMsEnums.FiveMinutes) { data.SaveMemorySnapshots(memorySnapshots); memorySnapshots = new List <MemorySnapshot>(); currentInterval = 0; } currentInterval += tenSeconds; Thread.Sleep(tenSeconds); } }
private string RunPythonScript() { return(ShellCommands.ExecuteCommand("python", "python2json.py")); }
private string RunListDir() { return(ShellCommands.ExecuteCommand("ls", "--lah")); }
private string RunDocker() { return(ShellCommands.ExecuteCommand("docker", "build --help")); }
public Shell AddCommand(ShellCommand command) { ShellCommands.CreateCommandButton(command); MobileShellCommands.CreateCommandButton(command); return(this); }