예제 #1
0
        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);
            }
        }
예제 #2
0
        public bool IsServiceStopped(string serviceName)
        {
            var service = LsbLinuxServiceController.GetService(serviceName);

            return(service == null || service.GetStatus() == ServiceControllerStatus.Stopped);
        }
예제 #3
0
        public bool IsServiceInstalled(string serviceName)
        {
            var service = LsbLinuxServiceController.GetService(serviceName);

            return(service != null);
        }