#!/bin/sh
# ~jhs/bin/.sh/xterms
# netstats	-> xterms
# xconsoles	-> xterms
# xloads	-> xterms

case `basename $0` in	#{
	# brackets.c: (
	"xterms")	#{
		hosts=`~jhs/private/bin/.sh/hosts`
		# # with path, else .xsession calling xauth.sh complains
                # to .xsession-errors
                # /home/jhs/bin/.sh/xterms: hosts: hosts: not found
		# command=xtermv
		# .xsession-errors: /home/jhs/bin/.sh/xterms: xtermv: not found
		command=/home/jhs/bin/.sh/xtermv
		;;	#}
	# brackets.c: (
	"xloads")	#{
		hosts=`~jhs/private/bin/.sh/hosts`
		command=xloadv
		;;	#}
	# brackets.c: (
	"xconsoles")	#{
		hosts=`~jhs/private/bin/.sh/hosts`
		command=xconsolev
		;;	#}
	# brackets.c: (
	"xpingscoax")	#{
		hosts="axis erik film flip king lapa lapd mini rain scan snow test"
		# For physical order see /site/usr/local/bin/host2number
		command=xpingvcoax
		;;	#}
	# brackets.c: (
	"xpingsall")	#{
		hosts="axis `~jhs/private/bin/.sh/hosts`"
		command=xpingvall
		;;	#}
	# brackets.c: (
	"netstats")
		hosts="mart.ext park.ext `~jhs/private/bin/.sh/hosts`"
		# hosts="$hosts mart.tun park.tun"
		command=xnetstatv
		;;	#}
	# brackets.c: (
	*)
		echo "$0 Not a recognised name"
		;;	#}
	esac    # }

for i in $hosts ; do
	#pre 2013-1123:	$command $i
	ping -c 1 `basename $i .ext` && $command $i &
	# '&' is so later hosts dont wait ages to be called, just because
	# some earlier host is turned off. The '&' also loads host
	# with a temporary burst of processes, but its a lot nicer than
	# having 'xterms' litter the display with a load of xterms that
	# only later time out & go away. & it much improves the situation
	# with 'netstats' when oherwise it would need about 30  mouse clicks to
	# place all those 80x24 full size xterms.
	done

case `basename $0` in	#{
	# brackets.c: (
	"xterms")	#{
		;;	#}
	# brackets.c: (
	"xconsoles")	#{
		;;	#}
	# brackets.c: (
	"xpingscoax")	#{
		# Pull up an editor to review physical order
		# while debugging cable.
		vi /site/usr/local/bin/host2number
		;;	#}
	# brackets.c: (
	"xpingsall")	#{
		;;	#}
	# brackets.c: (
	"netstats")	#{
		;;	#}
	# brackets.c: (
	"xloads")	#{
		;;	#}
	# brackets.c: (
	*)
		echo "$0 Not a recognised name"
		;;	#}
esac    # }
