Beispiel #1
0
        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;
            }
        }
Beispiel #2
0
 private void MainFrame_Navigating(object sender, NavigatingCancelEventArgs e)
 {
     if (ContentFrame.Content != null)
     {
         ShellCommands.Clear();
         MobileShellCommands.Clear();
     }
 }
Beispiel #3
0
 public void HideCommandBars(bool Hide)
 {
     if (Hide)
     {
         ShellCommands.HideItems(addLock: true);
         MobileShellCommands.HideItems(addLock: true);
     }
     else
     {
         ShellCommands.TryShowItems(unlock: true);
         MobileShellCommands.TryShowItems(unlock: true);
     }
 }
Beispiel #4
0
        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);
            }
        }
Beispiel #5
0
 private string RunPythonScript()
 {
     return(ShellCommands.ExecuteCommand("python", "python2json.py"));
 }
Beispiel #6
0
 private string RunListDir()
 {
     return(ShellCommands.ExecuteCommand("ls", "--lah"));
 }
Beispiel #7
0
 private string RunDocker()
 {
     return(ShellCommands.ExecuteCommand("docker", "build --help"));
 }
Beispiel #8
0
 public Shell AddCommand(ShellCommand command)
 {
     ShellCommands.CreateCommandButton(command);
     MobileShellCommands.CreateCommandButton(command);
     return(this);
 }