public void Stop(int timeout = Timeout.Infinite)
 {
     try
     {
         MonoHelper.ExecuteProcessSync("service", $" {ServiceName} stop", timeout);
     }
     catch (Exception error)
     {
         throw new InvalidOperationException(string.Format(Properties.Resources.CantStopService, ServiceName), error);
     }
 }
Exemplo n.º 2
0
        private static void UnregisterServiceFile(LinuxServiceSettings settings)
        {
            // Выполнение команды: 'update-rc.d -f <serviceFile> remove'

            var serviceFile = Path.GetFileName(BuildServicePath(settings));

            try
            {
                MonoHelper.ExecuteProcessSync("update-rc.d", $" -f {serviceFile} remove");
            }
            catch (Exception error)
            {
                throw new InstallException(string.Format(Properties.Resources.CantUnregisterServiceFile, serviceFile), error);
            }
        }