#!/bin/bash DEFAULT_PATH=/usr/local/bin/ AUX_SCRIPT_PATH=/usr/local/bin/ case "$1" in -h|-H|--help|--HELP) clear echo "DO_MASSDO version 11162k3-a" echo 'Requires do_ssh_hosts in /usr/bin' echo "Just a kludge so you don't have to keep remembering all those hostnames" echo "when running commands (esp the same command) on the cluster." echo "Syntax:" echo "do_massdo [ interactive ]|[ command ]" echo "Typing 'interactive' or 'i' as an argument to do_massdo will put the" echo "program into fully intractive mode. The program will ask permission" echo "before attempting to log in to each remote host." echo "Anything else on the command-line after the program's name" echo "will be interpreted as a command to pass along to the remote host" echo "vi SSH." exit 1 ;; -v|-V|--version|--VERSION|--ver|--VER|v|V) echo "DO_MASSDO -- Version 11162k3-a" ;; *) if [ "$1" ]; then { #A command was passed to do_ssh COMMAND="$1" for i in `cat ${AUX_SCRIPT_PATH}do_ssh_hosts`; do { echo ">>>>>>>>>>>>>> auto <<<<<<<<<<<<<<" echo "Processing $i...." echo ">>>>>>>>>>>>>> auto <<<<<<<<<<<<<<" ssh $i "$COMMAND" } done } else { #No command passed. Go into interactive mode. echo "Interactive mode." for i in `cat ${AUX_SCRIPT_PATH}do_ssh_hosts`; do { echo "==============================" echo "Processing $i...." echo "==============================" ssh $i } done } fi ;; esac echo "ENDRUN do_massdo version 11162k3-a."