Files
kubernetes/py-deploy/bin/mscp
2026-03-23 10:33:13 +08:00

22 lines
478 B
Bash

#!/bin/sh
BASEDIR=$(cd $(dirname "${BASH_SOURCE[0]}")/.. && pwd)
SSH_KEY=${BASEDIR}/$(ls ${BASEDIR} | egrep '.pem$' | head -n 1)
if [ $# -ne 2 ]; then
echo "Copy file to all hosts"
echo "Usage: $0 <source> <target>"
exit 1
fi
for host in $(cat ${BASEDIR}/hosts | grep -v "^#" | awk '{print $1}')
do
if ifconfig | grep inet | grep "${host}" >/dev/null ; then
# skip current host
continue
fi
#scp -i ${SSH_KEY} -r $1 ${host}:$2
scp -r $1 ${host}:$2
done