初始提交
This commit is contained in:
21
py-deploy/bin/mscp
Normal file
21
py-deploy/bin/mscp
Normal file
@@ -0,0 +1,21 @@
|
||||
#!/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
|
||||
Reference in New Issue
Block a user