Exemplo n.º 1
0
 public void SudoReboot()
 {
     using (var client = Ssh())
     {
         var wrapper = new SshClientWrapper(client);
         wrapper.SudoReboot();
     }
 }
Exemplo n.º 2
0
 public string SudoBash(string command)
 {
     using (var client = Ssh())
     {
         var result = new SshClientWrapper(client).RunSudoBash(command);
         return(result);
     }
 }
Exemplo n.º 3
0
 public string CommandWithStdIn(string command, string stdIn)
 {
     using (var client = Ssh())
     {
         var wrapper = new SshClientWrapper(client);
         var result  = wrapper.RunWithStdIn(command, new string[]   {
             stdIn
         });
         return(result);
     }
 }
Exemplo n.º 4
0
        public string ScriptWithStdIn(string scriptContent, string scriptName, string[] inputs)
        {
            using (var scpClient = Scp())
            {
                var stream = new MemoryStream(Encoding.UTF8.GetBytes(scriptContent));
                scpClient.Upload(stream, scriptName);
            }

            using (var client = Ssh())
            {
                var wrapper = new SshClientWrapper(client);
                var result  = wrapper.RunWithStdIn("sh " + scriptName, inputs);
                return(result);
            }
        }