public void StartInstance(string launchScriptPath) { var dir = MiscTools.DirWithoutFile(launchScriptPath); var cd = "cd " + dir.Quotate(); var sessionName = ServerScreenPrefix + dir.Replace('/', ':'); var fullCmd = cd.CombineCommand("screen -dmS " + sessionName.Quotate() + " ./launch.sh"); SshHandler.RunCommand(fullCmd); }
public void KillInstance(string path) { var runningScreens = SshHandler.GetRunningScreensRaw(); var screenid = runningScreens.Where(x => x.Replace(':', '/').EndsWith(MiscTools.DirWithoutFile(path))).FirstOrDefault(); SshHandler.RunCommand("screen -S " + screenid.Quotate() + " -X quit"); }
public void OpenPutty(string path) { var runningScreens = SshHandler.GetRunningScreensRaw(); var screenid = runningScreens.Where(x => x.Replace(':', '/').EndsWith(MiscTools.DirWithoutFile(path))).FirstOrDefault(); var proc = PuttyOpener.OpenPutty("screen -x " + screenid.Quotate()); proc.WaitForInputIdle(); }
public Task StopInstance(string path) { var runningScreens = SshHandler.GetRunningScreensRaw(); var screenid = runningScreens.Where(x => x.Replace(':', '/').EndsWith(MiscTools.DirWithoutFile(path))).FirstOrDefault(); var task = new Task(() => { SshHandler.RunCommand(("while screen -S " + screenid.Quotate() + " -X stuff \"stop\nend\n\"").CombineCommand("do sleep 0.5; done")); }); task.Start(); return(task); }