/// <summary> /// 执行具体任务 /// </summary> /// <param name="job"></param> public void ExeJob(Schedule_t job) { Process proc = null; proc = new Process(); proc.StartInfo.FileName = "helprun.exe"; proc.StartInfo.WorkingDirectory = Path.GetDirectoryName(job.application.Path); proc.StartInfo.Arguments = job.Uid + " " + job.application.Path + " " + job.Paras; proc.StartInfo.RedirectStandardOutput = true; proc.StartInfo.RedirectStandardInput = true; proc.StartInfo.RedirectStandardError = true; proc.StartInfo.UseShellExecute = false; proc.StartInfo.CreateNoWindow = true; proc.Start(); proc.WaitForExit(); proc.Close(); }
/// <summary> /// 输出日志到数据库 /// </summary> /// <param name="task"></param> public static void WriteLog(Schedule_t task, string msg = null) { //lock (typeof(LogHelper)) //{ // TaskEntities db = new TaskEntities(); // db.Log_t.Add(new Log_t() // { // Message = msg, // Result = 0, // Time = DateTime.Now, // ScheduleUid = task.Uid, // Type = 0 // }); // db.SaveChanges(); //} }