+#!/bin/ksh
+################################################################################
+#
+# File: infrastructuremach
+# Description: A script to execute a command on all infrastructure class machines
+# Author: Andrew@DeFaria.com
+# Created: Thu May 11 11:08:24 PDT 2000
+# Modified:
+# Language: Korn Shell
+#
+# (c) Copyright 2001, Andrew@DeFaria.com, all rights reserved
+#
+################################################################################
+# Set me to command name
+me=$(basename $0)
+
+# Set adm_base
+adm_base=${adm_base:-$HOME/adm}
+
+# Set adm_fpath
+adm_fpath=${adm_fpath:-$adm_base/functions}
+
+# Source functions
+. $adm_fpath/common
+
+# Set machines
+machines=${machines:-$adm_base/data/machines}
+
+if [ "$1" = "-f" ]; then
+ shift
+ machines="$1"
+ shift
+fi
+
+PATH=/adm/bin:$PATH
+
+if [ "$1" = "-r" ]; then
+ root=yes
+ shift
+fi
+
+for infrastructure_machine in $(grep -ve ^# $machines | grep Infrastructure
+| cut -d: -f1); do
+ # Execute command. Note if no command is given then the effect is to
+ # rlogin to each machine.
+ print "$infrastructure_machine:$@"
+ if [ $# -gt 0 ]; then
+ if [ -z "$root" ]; then
+ remsh $infrastructure_machine -n "$@"
+ else
+ root remsh $infrastructure_machine -n "$@"
+ fi
+ else
+ if [ -z "$root" ]; then
+ remsh $infrastructure_machine
+ else
+ root remsh $infrastructure_machine
+ fi
+ fi
+done