|
|
@ -29,6 +29,7 @@ namespace Txgy.RBS.Services
|
|
|
|
_cache = cache;
|
|
|
|
_cache = cache;
|
|
|
|
RedisServer = new ProcessInfo()
|
|
|
|
RedisServer = new ProcessInfo()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
ProPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, CommonData.RedisDefaultPath),
|
|
|
|
ProName = "server",
|
|
|
|
ProName = "server",
|
|
|
|
StartTime = DateTime.Now,
|
|
|
|
StartTime = DateTime.Now,
|
|
|
|
State = true
|
|
|
|
State = true
|
|
|
@ -40,13 +41,16 @@ namespace Txgy.RBS.Services
|
|
|
|
{
|
|
|
|
{
|
|
|
|
foreach (var item in ProjectMonitor)
|
|
|
|
foreach (var item in ProjectMonitor)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
_redisList.Publish(CommonData.RedisPublish, Newtonsoft.Json.JsonConvert.SerializeObject(new
|
|
|
|
int sfServer = FindProcess(RedisServer);
|
|
|
|
|
|
|
|
RedisServer.State = sfServer == 0 ? true : false;
|
|
|
|
|
|
|
|
var messageRerver = new
|
|
|
|
{
|
|
|
|
{
|
|
|
|
projectName = item.Key,
|
|
|
|
projectName = item.Key,
|
|
|
|
ProName = RedisServer.ProName,
|
|
|
|
ProName = RedisServer.ProName,
|
|
|
|
RunState = RedisServer.State?1:0,
|
|
|
|
RunState = RedisServer.State ? 1 :2,
|
|
|
|
RunTime = (DateTime.Now - RedisServer.StartTime).TotalSeconds,
|
|
|
|
RunTime = (DateTime.Now - RedisServer.StartTime).TotalSeconds,
|
|
|
|
}));
|
|
|
|
};
|
|
|
|
|
|
|
|
_redisList.Publish(CommonData.RedisPublish, Newtonsoft.Json.JsonConvert.SerializeObject(messageRerver));
|
|
|
|
foreach (var proValue in item.Value.GetType().GetProperties())
|
|
|
|
foreach (var proValue in item.Value.GetType().GetProperties())
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var pro = proValue.GetValue(item.Value) as ProcessInfo;
|
|
|
|
var pro = proValue.GetValue(item.Value) as ProcessInfo;
|
|
|
@ -68,7 +72,8 @@ namespace Txgy.RBS.Services
|
|
|
|
{
|
|
|
|
{
|
|
|
|
projectName=item.Key,
|
|
|
|
projectName=item.Key,
|
|
|
|
ProName = pro.ProName,
|
|
|
|
ProName = pro.ProName,
|
|
|
|
RunState = sfp == 0 ? 1 : 0,
|
|
|
|
//0已停止,1正常启动,2启动失败;
|
|
|
|
|
|
|
|
RunState = sfp == 0 ? 1 : 2,
|
|
|
|
RunTime = (DateTime.Now - pro.StartTime).TotalSeconds,
|
|
|
|
RunTime = (DateTime.Now - pro.StartTime).TotalSeconds,
|
|
|
|
}));
|
|
|
|
}));
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -104,8 +109,9 @@ namespace Txgy.RBS.Services
|
|
|
|
{
|
|
|
|
{
|
|
|
|
projectName = projectName,
|
|
|
|
projectName = projectName,
|
|
|
|
ProName = pro.ProName,
|
|
|
|
ProName = pro.ProName,
|
|
|
|
|
|
|
|
//0已停止,1正常启动,2启动失败;
|
|
|
|
RunState = 0,
|
|
|
|
RunState = 0,
|
|
|
|
RunTime = (DateTime.Now - pro.StartTime).TotalSeconds,
|
|
|
|
RunTime = 0,
|
|
|
|
}));
|
|
|
|
}));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -336,14 +342,7 @@ namespace Txgy.RBS.Services
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
List<Process> pro = null;
|
|
|
|
List<Process> pro = null;
|
|
|
|
if (processInfo.ProName == "server")
|
|
|
|
pro = localByName.Where(p => p.MainModule.FileName.Contains(processInfo.ProPath)).ToList();
|
|
|
|
{
|
|
|
|
|
|
|
|
pro = localByName.Where(p => p.MainModule.FileName.Contains(processInfo.ProName)).ToList();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
pro = localByName.Where(p => p.MainModule.FileName.Contains(processInfo.ProPath)).ToList();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!pro.Any())
|
|
|
|
if (!pro.Any())
|
|
|
|
{
|
|
|
|
{
|
|
|
|
ri = 1;
|
|
|
|
ri = 1;
|
|
|
|