Ejemplo n.º 1
0
        public void Run(string computerNamesContains,string serviceName,int timeoutSeconds)
        {
            var servers = new Servers(ldap, log);
            var list = servers.Get();
            Parallel.ForEach(list, name =>
            {
                LogicalThreadContext.Properties["MachineName"] = name;

                if(name.ToLower().Contains(computerNamesContains.ToLower()))
                {
                    log.Info("Processing");
                    var svcState = new SvcState(name, serviceName, log);
                    svcState.RestartService(timeoutSeconds * 1000);
                }

                //Console.WriteLine("Processing {0} on thread {1}", name, Thread.CurrentThread.ManagedThreadId);

            } //close lambda expression
            ); //close method invocation
        }
Ejemplo n.º 2
0
 public void Should_restart_service()
 {
     var svcState = new SvcState("CruiseAgent55", "SQLWriter", log);
     svcState.RestartService(10000);
 }