same as its own name -- using the -s (short) argument to make sure we're not comparing servername to servername.domain.com. And it then uses scp to copy the file in question to each server that isn't itself. The server names (e.g., server-1) have to be replaced with the actual names, of course.
# copy file to remote servers
for server in server-1 server-2 server-3 server-4
do
if [ $server != `hostname -s` ]; then # don't copy to self
scp -p $file $server:$file
fi
done
The nice thing about this technique is that you could use this script to copy a file from any of the servers to the other three without making any changes to the script,
air jordans for cheap. The "copy to everywhere but myself",
cheap real jordans; logic makes this work.
Alternately, you could have the server names list in a separate file and change your syntax to "for server in `cat serverlist`", but you would have to keep the serverlist files synchronized on the servers as well. With this script, you just have to copy the script itself. And,
cheap air jordans,
www.amassdenver.com, of course, make sure you have your systems set up to trust each other or run the script only from one of the servers that the other trust. Or,
wholesale cheap jordans, of course, you can provide passwords as you loop through the server list.
#!/bin/bash
if [ $# == 0 ]; then
echo -n "file>,
wholesale cheap jordans; "
read file
else
file=$1
fi
if [ ! -f $file ]; then
echo "ERROR: No file named $file found"
exit 1
fi
if [[ ${file:0:1} != / &&,
amass denver; ${file:0:1} != ~ ]]; then
path=`pwd`
file=$path/$file
fi
# copy file to remote servers
for server in server-1 server-2 server-3 server-4
do
if [ $server != `hostname -s` ],
air jordans for cheap; then # don't copy to self
scp -p $file $server:$file
fi
done
Making a change on one system
cheap jordan shoes Science News - Technology_34
cheap real jordans Ravens coach John Harbaugh look
amass denver Science News - Evolution_32
cheap retro jordans Scheduled to start Sunday, Ori
www.amassdenver.com Robert E. Brown Jr., Ferris Ba
cheap air jordans Malaria Articles, Photos, and Vi