Triggering a Full Restart or Service-Level Restart

Call InitiateRackRestartAsync with the input parameter RackRestartLevel.FullRestart to trigger a full restart, or RackRestartLevel.ServiceLevelRestart to trigger a service-level restart. The InitiateRackRestartAsync function internally calls IAteCoreSession.Dispose so you do not need to explicitly call the Dispose function.

Restarting the RCU Service

IAteCoreSession ateCoreSession; 
try 
{ 
	// To create an object of IAteCoreSession. 
	ateCoreSession = await AteCoreSession.CreateAteCoreSessionAsync(hostname, password); 
 
	// Perform a full restart 
	await ateCoreSession.InitiateRackRestartAsync(RackRestartLevel. ServiceLevelRestart); // Dispose ateCoreSession will be handled in InitiateRackRestartAsync 
	Stopwatch stopWatch = new Stopwatch(); 
	stopWatch.Start(); 
	while (true) 
	{ 
		try 
		{ 
			ateCoreSession = await AteCoreSession.CreateAteCoreSessionAsync(hostname, password); 
			break; 
		} 
		catch 
		{ 
			// Timeout after 20 seconds. 
			if (stopWatch.ElapsedMilliseconds > 20* 1000) 
			{ 
				throw new TimeoutException(); 
			} 
		} 
	} 
	stopWatch.Stop();	 
} 
catch(Exception ex) 
{ 
	Console.WriteLine(ex.Message); //Print the exception message. 
} 
finally 
{ 
	if (ateCoreSession != null) 
	{ 
		// To close the session. 
		ateCoreSession.Dispose(); 
	} 
}