示例#1
0
        public static void Set()
        {
            var options = Application.CurrentConfiguration.Cluster.SharedFs;

            if (options == null)
            {
                return;
            }
            Systemctl.Enable(serviceName);
            Systemctl.Start(serviceName);
            var nodes = Application.CurrentConfiguration.Cluster.Nodes;

            for (var i = 0; i < nodes.Length; i++)
            {
                IncludeNode(nodes[i].Hostname);
            }

            for (var i = 0; i < options.VolumesLabels.Length; i++)
            {
                var currentLabel = options.VolumesLabels[i];
                //creo e avvio il volume di Gluster sui vari nodi in cui è configurato
                StartVolume(currentLabel, nodes);
            }
            ConsoleLogger.Log("[gluster] start");
        }
示例#2
0
        public static void Start()
        {
            var conf        = Application.CurrentConfiguration.Network.WpaSupplicant;
            var serviceName = CommonString.Append("wpa_supplicant@", conf.Interface, ".service");

            Systemctl.Start(serviceName);
        }
示例#3
0
文件: Ntp.cs 项目: jeason0813/Antd
        public static bool Set()
        {
            var currentConfig          = Application.CurrentConfiguration.Network.InternalNetwork;
            var parsedNetworkParameter = LukeSkywalker.IPNetwork.IPNetwork.Parse(currentConfig.IpAddress, currentConfig.NetworkRange);
            var network = parsedNetworkParameter.Network.ToString();
            var mask    = parsedNetworkParameter.Netmask.ToString();
            var lines   = new string[] {
                "interface ignore wildcard",
                $"interface listen {currentConfig.IpAddress}",
                $"restrict {network} mask {mask} nomodify",
                "",
                "server 0.it.pool.ntp.org",
                "server 1.it.pool.ntp.org",
                "server 2.it.pool.ntp.org",
                "server 3.it.pool.ntp.org",
                "server 193.204.114.232",
                "server 193.204.114.233",
                "server ntp1.ien.it",
                "server ntp2.ien.it",
                "",
                "statistics loopstats",
                "driftfile /var/lib/ntp/ntp.drift",
                "logfile /var/log/ntp/ntpd.log",
                "statsdir /var/log/ntp/",
                "filegen peerstats file peers type day link enable",
                "filegen loopstats file loops type day link enable"
            };

            File.WriteAllLines(ntpConfFileTmp, lines);
            if (File.Exists(ntpConfFile))
            {
                var existingFileHash = CommonFile.GetHash(ntpConfFile);
                var newFileHash      = CommonFile.GetHash(ntpConfFileTmp);
                if (CommonString.AreEquals(existingFileHash, newFileHash) == true)
                {
                    return(true);
                }
                else
                {
                    File.Copy(ntpConfFileTmp, ntpConfFile, true);
                }
            }
            else
            {
                File.WriteAllLines(ntpConfFile, lines);
            }
            if (File.Exists(ntpConfFileTmp))
            {
                File.Delete(ntpConfFileTmp);
            }
            Systemctl.Start(ntpdService);
            return(true);
        }
示例#4
0
 public static void Setup()
 {
     if (IsTargetActive())
     {
         return;
     }
     ConsoleLogger.Log($"[{applicativeTarget}] setup");
     if (!Directory.Exists("/usr/lib64/systemd/system/"))
     {
         return;
     }
     Directory.CreateDirectory("/etc/systemd/system/");
     Directory.CreateDirectory("/etc/systemd/system/applicative.target.wants");
     Directory.CreateDirectory("/mnt/cdrom/Units/applicative.target.wants");
     WriteTimerTargetFile();
     WriteTimerServiceFile();
     WriteTimerMountFile();
     Bash.Execute("ln -s ../../../../usr/lib64/systemd/system/applicative.service applicative.service", "/etc/systemd/system/multi-user.target.wants", false);
     Systemctl.Start(applicativeService);
     Systemctl.Start(applicativeTarget);
     Systemctl.DaemonReload();
 }
示例#5
0
文件: Ntp.cs 项目: jeason0813/Antd
 public static void Start()
 {
     Systemctl.Start(ntpdService);
 }
示例#6
0
 public static void Start()
 {
     Systemctl.Start(applicativeTarget);
 }