public void StopService(string serviceName, TimeSpan timeout) { var service = LsbLinuxServiceController.GetService(serviceName); if (service == null) { throw new InvalidOperationException(string.Format(Resources.ServiceHasntInstalled, serviceName)); } try { service.Stop(timeout); } catch (Exception error) { _logWriter.Error(error.Message, error); } }
public bool IsServiceStopped(string serviceName) { var service = LsbLinuxServiceController.GetService(serviceName); return(service == null || service.GetStatus() == ServiceControllerStatus.Stopped); }
public bool IsServiceInstalled(string serviceName) { var service = LsbLinuxServiceController.GetService(serviceName); return(service != null); }