public static bool ShutDown(ISession session, SchManager sch, out string msg) { bool result = true; msg = ""; string OutMsg = ""; try { //do stop if (!ExecuteProcess(sch.Path, sch.FileName, "KILL", out OutMsg)) { msg += "Stop SCH GAGAL. " + OutMsg; } string sekarang = DateTime.Now.ToString("dd/MM/yyyy hh:mm:ss"); sch.RestartStatus = ParameterHelper.SCH_OFF; sch.Message = sekarang + " Success Shutdown.|" + sch.Message; sch.ErrorDescription = sch.Message; sch.LastUpdate = DateTime.Now; session.Update(sch); session.Flush(); } catch (Exception e) { OutMsg = "Exception " + e.Message + "||" + e.InnerException + "||" + e.StackTrace; result = false; } return(result); }
public static bool ReadLog(ISession session, SchManager sch, out string msg) { bool result = true; msg = ""; try { string LogPath = sch.Path + "\\logs\\log.txt"; FileInfo FileLogInfo = new FileInfo(LogPath); //FileAttributes FileLogAtribut = FileLogInfo.Attributes; sch.SchLogLastUpdate = FileLogInfo.LastWriteTime; session.Update(sch); session.Flush(); } catch (Exception e) { msg = e.Message + "||" + e.InnerException + "||" + e.StackTrace; } return(result); }