Advertisement
Guest User

Untitled

a guest
Aug 30th, 2016
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.09 KB | None | 0 0
  1. if (operatingSystem.ToString().Contains("Ubuntu"))
  2.             {
  3.                 try
  4.                 {
  5.                     using (var client = new SshClient(srvIP, srvUser, srvPassword))
  6.                     {
  7.                         client.Connect();
  8.                         client.RunCommand("cd ~");
  9.                         client.RunCommand("git clone " + gitUrl + " build");
  10.                         client.RunCommand("cd build && ./autogen.sh && ./configure --with-incompatible-bdb --enable-hardening && make");
  11.                         client.RunCommand("cd build && make install");
  12.                         client.RunCommand("mkdir " + DataDir);
  13.                         client.RunCommand("touch " + DataDir + "/" + ConfigName);
  14.                         client.RunCommand("echo server=1 >> " + DataDir + "/" + ConfigName);
  15.                         client.RunCommand("echo listen=1 >> " + DataDir + "/" + ConfigName);
  16.                         client.RunCommand("echo daemon=1 >> " + DataDir + "/" + ConfigName);
  17.                         client.RunCommand("echo rpcallow=" + rpcAllow + " >> " + DataDir + "/" + ConfigName);
  18.                         client.RunCommand("echo rpcallowip=" + rpcAllow + " >> " + DataDir + "/" + ConfigName);
  19.                         client.RunCommand("echo rpconnect=" + rpcAllow + " >> " + DataDir + "/" + ConfigName);
  20.                         client.RunCommand("echo rpcport=" + rpcPort + " >> " + DataDir + "/" + ConfigName);
  21.                         client.RunCommand("echo rpcuser=" + rpcUser + " >> " + DataDir + "/" + ConfigName);
  22.                         client.RunCommand("echo rpcpassword=" + rpcPassword + " >> " + DataDir + "/" + ConfigName);
  23.                         client.RunCommand(DaemonName);
  24.                         client.RunCommand("rm -rf build");
  25.                         client.Disconnect();
  26.  
  27.                         return Content("The Ubunutu Update for " + ServerName + " is compelte");
  28.                     }
  29.                 }
  30.  
  31.                 catch (Exception ex)
  32.                 {
  33.                     return Content("A Failure occured" + ex);
  34.                 }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement