protected override bool isServiceRunning(TimeSpan timeout, string service) { bool isRunning = false; string host = ParseHostName(ServerName); NodeOSInfo osInfo = HostInfo.GetHostInfo(host); if (osInfo == null) { return(isRunning); } if (osInfo.HostOS == OSInfo.Linux) { ExecuteUnixServiceCommand(timeout, ServiceOptions.ISRUNNING, ""); isRunning = isRunningOnUnix; } else { isRunning = base.isServiceRunning(timeout, ServiceNames.JVCACHE); } return(isRunning); }
public static NodeOSInfo GetHostInfo(string nodeIP) { NodeOSInfo nodeInfo; if (s_hostInfoMap.TryGetValue(nodeIP, out nodeInfo)) { return(s_hostInfoMap[nodeIP]); } else { OSInfo osInfo = OSDetector.DetectOS(nodeIP); if (OSDetector.hostIP == null) { return(null); } var detectedIP = OSDetector.hostIP; if (detectedIP != null) { nodeIP = detectedIP; } if (osInfo == OSInfo.Linux) { nodeInfo = new NodeOSInfo(nodeIP, OSInfo.Linux); AddHostInfo(nodeIP, nodeInfo); return(nodeInfo); } else if (osInfo == OSInfo.Windows) { nodeInfo = new NodeOSInfo(nodeIP, OSInfo.Windows); AddHostInfo(nodeIP, nodeInfo); return(nodeInfo); } else { nodeInfo = new NodeOSInfo(nodeIP, OSInfo.Unknown); AddHostInfo(nodeIP, nodeInfo); return(nodeInfo); } } }
protected override void Restart(TimeSpan timeout, string service) { string host = ParseHostName(ServerName); NodeOSInfo osInfo = HostInfo.GetHostInfo(host); if (osInfo == null) { return; } if (osInfo.HostOS == OSInfo.Linux) { ExecuteUnixServiceCommand(timeout, ServiceOptions.RESTART, ""); } else { base.Restart(timeout, ServiceNames.JVCACHE); } }
public override void RestartSvcAfterNICChanged(TimeSpan timeout, string previousServerNode) { string host = ParseHostName(previousServerNode); NodeOSInfo osInfo = HostInfo.GetHostInfo(host); if (osInfo == null) { return; } if (osInfo.HostOS == OSInfo.Linux) { ExecuteUnixServiceCommand(timeout, ServiceOptions.RESTARTNICCHANGE, previousServerNode); } else { base.Restart(timeout, ServiceNames.JVCACHE); } }
public void UpdateHostInfo(string nodeIP, NodeOSInfo nodeInfo) { s_hostInfoMap[nodeIP] = nodeInfo; }
public static void AddHostInfo(string nodeIP, NodeOSInfo nodeInfo) { s_hostInfoMap[nodeIP] = nodeInfo; }