Miscellaneous

Controlling NT services

A small convenience feature, to start/stop NT services.

<!-- Restart W3SVC -->
<service serviceName="w3svc" command='isInstalled' outTo='installed' />
<print>Service is ${=$installed?'installed':'not installed'}</print>
<if isTrue='${installed}'>
	<service serviceName="w3svc" command='stop' />
	<print>Stopping</print>
	<service serviceName="w3svc" command='waitForStopped' />
	<print>Stopped</print>
	<service serviceName="w3svc" command='start' />
	<print>Starting</print>
	<service serviceName="w3svc" command='waitForRunning' />
	<print>Done</print>
</if>

Delaying and timing script execution

<!-- Wait for 5 seconds, then for 3 more seconds, then print the elapsed time (should be around 8 seconds if my math is right) -->
<timer format="elapsed" outTo="tm">
	<print newline='false'>Waiting for 5 seconds...   </print>
	<sleep timeout='00:00:05' />
	<print newline='false'>Almost ...</print>
	<sleep timeout='3000' />
	<print>Done!</print>
</timer>
<print>Elapsed: ${tm}</print>