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"); } }
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); } } } }
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); } }