Re: copy one file, multiple machines
On Fri, Jun 03, 2005 at 09:54:32AM -0400, jmr_071769 wrote:
} howdy everyone.
}
} this is more of a linux question. i have script_filename_sh that i'd
} like to copy to multiple /etc/cron.daily/ directories on our network.
} what's a nifty script that could save me from up-arrow'ing/scp'ing to death?
}
} for instance:
}
} scp script_filename_sh machine1:/etc/cron.daily/
} scp script_filename_sh machine2:/etc/cron.daily/
}
} so on, so on... we have like 50 machines...
csh derivatives:
foreach m (machine1 machine2 ...)
scp script_filename_sh "$m":/etc/cron.daily
end
sh derivatives:
for m in machine1 machine2 ...
do
scp script_filename_sh "$m":/etc/cron.daily
done
If you're feeling your Wheaties, use this script:
#!/bin/sh
if test $# -lt 3 || test ! -r "$1"
then
echo "Usage: $0 <file> <destination path> <machines ...>" >&2
exit 1
fi
FNAME="$1"
shift
DEST="$1"
shift
for m in "$@"
do
scp "$FNAME" "$m":"$DEST"
done
} thanks!
} -jeff
--Greg
Reply to: