示例#1
0
        public static void Stop()
        {
            var conf        = Application.CurrentConfiguration.Network.WpaSupplicant;
            var serviceName = CommonString.Append("wpa_supplicant@", conf.Interface, ".service");

            Systemctl.Stop(serviceName);
        }
示例#2
0
文件: Samba.cs 项目: jeason0813/Antd
 public static void Stop()
 {
     Systemctl.Stop(ServiceName1);
     Systemctl.Stop(ServiceName2);
     Systemctl.Stop(ServiceName3);
     ConsoleLogger.Log("[samba] stop");
 }
示例#3
0
        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);
        }
示例#4
0
 public static void Stop()
 {
     Systemctl.Stop(serviceName);
     ConsoleLogger.Log("[gluster] stop");
 }
示例#5
0
 public static void Stop()
 {
     Systemctl.Stop(ServiceName);
     ConsoleLogger.Log("[nginx] stop");
 }