예제 #1
0
        private static void InstallAndStartLocalWorker()
        {
            logger.Info($"Attempting to install the {Constants.LocalWorkerServiceName}...");

            ServicesHelper.InstallService(Constants.LocalWorkerServiceName, Settings.LocalWorkerServiceExecutablePath);

            logger.Info($"{Constants.LocalWorkerServiceName} installed successfully.");

            StartLocalWorker();
        }
예제 #2
0
        private void StartMonitoringService()
        {
            const string monitoringServiceName = Constants.LocalWorkerMonitoringServiceName;

            var serviceState = ServicesHelper.GetServiceState(monitoringServiceName);

            if (serviceState.Equals(ServiceState.Running))
            {
                this.Logger.Information("{Service} is running.", monitoringServiceName);
                return;
            }

            this.Logger.Information("Attempting to start the {Service}...", monitoringServiceName);

            if (serviceState.Equals(ServiceState.NotFound))
            {
                ServicesHelper.InstallService(monitoringServiceName, Settings.MonitoringServiceExecutablePath);
            }

            ServicesHelper.StartService(monitoringServiceName);

            this.Logger.Information("{Service} started successfully.", monitoringServiceName);
        }