set sites “test”
foreach site $sites {
	if {$site == “test” } {
		netcfgLoad
		set processes [lsort [netcfgGetProcList]]
		echo $processes
	}
	echo “Stopping Processes in site $site”
	echo “——————————–”
	foreach process $processes {
		set out [exec tcl [file join $::HciRoot bin hciprocstatus.htc] -p $process]
		if {[string match -nocase *dead* $out] == 0} {
			echo “About to KILL $process”
			echo [THREADCTL die [string trim $process]]
			lappend processesToRestart $process
		}
	}
	echo “Restarting Processes in site $site”
	echo “——————————–”
	foreach process $processesToRestart {
		set out [exec tcl [file join $::HciRoot bin hciprocstatus.htc] -p $process]
		if {[string match -nocase *dead* $out] == 1} {
			echo “About to Start $process”
			echo [exec perl [file join $::HciRoot bin hcienginerun.pl] -p $process]
		}
	}
	set processesToRestart “”
}
I am fairly new to TCL so please excuse any basic errors.
I have been testing this from hcitcl run in the shell window and every so often the command hciprocstatus hcienginerun