Esempio n. 1
0
 public void EnsureSystemCtlServiceIsNotRunning()
 {
     // Mosquitto is run as docker container. If it's already running as systemctl service it will conflict so needs to be disabled
     if (SystemCtl.Exists("mosquitto"))
     {
         SystemCtl.Stop("mosquitto");
         SystemCtl.Disable("mosquitto");
     }
 }
Esempio n. 2
0
 public void Restart(DeviceInfo device)
 {
     if (device.Host == Context.Settings.HostName)
     {
         if (device.Group != "ui")
         {
             var serviceName = "growsense-mqtt-bridge-" + device.Name;
             if (SystemCtl.Exists(serviceName))
             {
                 SystemCtl.Restart(serviceName);
             }
         }
     }
 }
Esempio n. 3
0
        public void AssertSystemctlServiceExists(string serviceName)
        {
            Console.WriteLine("Asserting systemctl service file exists...");

            Console.WriteLine("  Is mock systemctl: " + (this.SystemCtl.GetType().Name.IndexOf("Mock") > -1));

            var fileExists = SystemCtl.Exists(serviceName);

            if (!fileExists)
            {
                var filePath = SystemCtl.GetServiceFilePath(serviceName);

                throw new Exception("Systemctl service file " + serviceName + " doesn't exist at " + filePath);
            }
        }