All pastes #439791 Raw Edit

Someone

public text v1 · immutable
·published 2007-04-14 15:14 UTC
rendered paste body
#!/bin/bash
#Default list of hosts to use
INFILE=/home/fallen/BACKUP/linux_hosts

#Directory where we keep the file to be copied
FILEDIR=/root/SNMP/dump.log

#The default output file
OUTFILE=${0}_output

ECHO=/bin/echo
SCP=/usr/bin/scp
SSH=/usr/bin/ssh
CAT=/bin/cat
RM=/bin/rm
TOUCH=/bin/touch
TEE=/usr/bin/tee

if [ -z "$*" ]; then
  ${ECHO}
  ${ECHO} "$0 -- a simple bash script for copying a file to"
  ${ECHO} "multiple machines via scp."
  ${ECHO}
  ${ECHO} "Hacked by Fallen "
  ${ECHO}
  ${ECHO} "Usage: $0 remotepathtofile/file"
  ${ECHO}
  ${ECHO} "Note: Always looks in $FILEDIR for the file to be copied"
  ${ECHO}
  ${ECHO} " [-f filename] Use list of hosts contained in filename"
  ${ECHO} "               instead of ${INFILE}"
  ${ECHO} " [-r filename] Direct the output to filename+screen"
  exit $?
fi

while getopts ":f:r:" opt; do
  case $opt in
    f ) INFILE=${OPTARG};;
    r ) OUTFILE=${OPTARG};;
   \? ) ${ECHO} "Illegal option -${OPTARG}"
        exit 1
  esac
done