Added client work scripts
[clearscm.git] / clients / HP / bin / desktopmach
diff --git a/clients/HP/bin/desktopmach b/clients/HP/bin/desktopmach
new file mode 100644 (file)
index 0000000..f128765
--- /dev/null
@@ -0,0 +1,60 @@
+#!/bin/ksh
+################################################################################
+#
+# File:         desktopmach
+# Description:  A script to execute a command on all desktop 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 desktop_machine in $(grep -ve ^# $machines | grep :Desktop: | cut -d:
+-f1); do
+  # Execute command. Note if no command is given then the effect is to
+  # rlogin to each machine.
+  print "$desktop_machine:$@"
+  if [ $# -gt 0 ]; then
+    if [ -z "$root" ]; then
+      remsh $desktop_machine -n "$@"
+    else
+      root remsh $desktop_machine -n "$@"
+    fi
+  else
+    if [ -z "$root" ]; then
+      remsh $desktop_machine
+    else
+      root remsh $desktop_machine
+    fi
+  fi
+done