#!/bin/sh
## Author: Pavan Bandaru
## Date: 9/28/2018
set -x
display_usage() {
echo "This script must be run with ...."
echo -e "\nUsage:\n$0 [hostfile.txt] \n"
}
if [ $# -eq 0 ]; then
display_usage
exit 1
fi
hostfile=$1
for host in `cat<$hostfile`
do
hostname=$(echo $host|awk -F"," '{print $1}')
echo "------------------------------------------------"
echo "connecting to $hostname"
rsync -r localdir ${hostname}:/home/pavan/
RESULT=$?
if [ $RESULT -ne 0 ]; then
echo Login Failed
fi
done
## Author: Pavan Bandaru
## Date: 9/28/2018
set -x
display_usage() {
echo "This script must be run with ...."
echo -e "\nUsage:\n$0 [hostfile.txt] \n"
}
if [ $# -eq 0 ]; then
display_usage
exit 1
fi
hostfile=$1
for host in `cat<$hostfile`
do
hostname=$(echo $host|awk -F"," '{print $1}')
echo "------------------------------------------------"
echo "connecting to $hostname"
rsync -r localdir ${hostname}:/home/pavan/
RESULT=$?
if [ $RESULT -ne 0 ]; then
echo Login Failed
fi
done
Note: Keep the remote host list on the host file.
No comments:
Post a Comment