public static void Start() { if (Systemctl.IsEnabled(ServiceName1) == false) { Systemctl.Enable(ServiceName1); } if (Systemctl.IsActive(ServiceName1) == false) { Systemctl.Restart(ServiceName1); } if (Systemctl.IsEnabled(ServiceName2) == false) { Systemctl.Enable(ServiceName2); } if (Systemctl.IsActive(ServiceName2) == false) { Systemctl.Restart(ServiceName2); } if (Systemctl.IsEnabled(ServiceName3) == false) { Systemctl.Enable(ServiceName3); } if (Systemctl.IsActive(ServiceName3) == false) { Systemctl.Restart(ServiceName3); } ConsoleLogger.Log("[samba] start"); }
private static void SaveKeepalived(ClusterNetwork networkConfig, ClusterNode[] nodesConfig) { if (networkConfig == null) { ConsoleLogger.Log("[cluster] keepalived not configured: missing network parameters"); return; } if (!networkConfig.Active) { ConsoleLogger.Log("[cluster] shared network is disabled"); return; } var ports = networkConfig.PortMapping; if (!ports.Any()) { ConsoleLogger.Log("[cluster] exit: !ports.Any()"); return; } ConsoleLogger.Log("[cluster] init keepalived"); const string keepalivedService = "keepalived.service"; if (Systemctl.IsActive(keepalivedService)) { ConsoleLogger.Log("[cluster] stop service"); Systemctl.Stop(keepalivedService); } ConsoleLogger.Log("[cluster] set configuration file"); var lines = new string[] { "vrrp_script chk_haproxy {", " script \"killall -0 haproxy\"", " interval 30", " weight 2", "}", "", "vrrp_instance RH_INT {", $" interface {networkConfig.NetworkInterface}", " state MASTER", " virtual_router_id 51", $" priority 100", " virtual_ipaddress {", $" {networkConfig.VirtualIpAddress}", " }", " track_script {", " chk_haproxy", " }", "}", }; File.WriteAllLines(keepalivedFileOutput, lines); Keepalived.Stop(); Keepalived.Start(keepalivedFileOutput); }
public static void Start() { if (Systemctl.IsEnabled(ServiceName) == false) { Systemctl.Enable(ServiceName); } if (Systemctl.IsActive(ServiceName) == false) { Systemctl.Restart(ServiceName); } ConsoleLogger.Log("[nginx] start"); }
public static void Start() { if (Systemctl.IsEnabled(serviceName) == false) { Systemctl.Enable(serviceName); } if (Systemctl.IsActive(serviceName) == false) { Systemctl.Restart(serviceName); } ConsoleLogger.Log("[syslogng] start service"); }