コード例 #1
0
        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);
        }
コード例 #2
0
        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");
        }
コード例 #3
0
        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();
        }
コード例 #4
0
        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);
        }