/// <summary> /// 停止计划任务 /// </summary> /// <param name="projectAction"></param> private void StopSchTasks(DepProjectAction projectAction) { DepProjectItem projectItem = SvnProcesser.ProjectItem(projectAction.DepId); string strOutput = SchTasksOperate.StopRun(projectItem.WebSite); Logger.SaveLog(strOutput); SvnProcesser.UpdateDeployStatus(projectAction.Id, SUCCESS, strOutput); }
/// <summary> /// 快速部署计划任务 /// </summary> private void DoSchTaskQuickDeploy(DepProjectAction projectAction, DepProjectItem projectItem) { //更新缓存 DepProject project = SvnProcesser.Project(projectItem.DepId); int gameId = project.GameId; int serverId = projectItem.ServerId; string host = project.ExcludeFile;//配置成Socket地址 using (GameSocketClient client = new GameSocketClient()) { string msg = string.Empty; client.ReceiveHandle += new SocketCallback((error, errorInfo, buffer) => { try { msg += string.Format("cache cmd:{0}-{1}\r\n", error, errorInfo); //停止计划任务 msg += SchTasksOperate.StopRun(projectItem.WebSite); string deploymsg = string.Empty; if (Deploy(projectAction, ref deploymsg)) { msg += deploymsg; int sleepTime = SVN_QDEPLOY_WAIT + new Random().Next(1, 10); Thread.Sleep(sleepTime * 1000); //开启计划任务 msg += SchTasksOperate.StartRun(projectItem.WebSite); } SvnProcesser.UpdateDeployStatus(projectAction.Id, SUCCESS, msg); } catch (Exception ex) { new BaseLog().SaveLog("DoSchTaskQuickDeploy", ex); SvnProcesser.UpdateDeployStatus(projectAction.Id, ERROR, ex.ToString()); } }); client.Connect(host); string command = "GM:cache"; client.SendToServer(gameId, serverId, 1000, command); } }