sync.sh
#!/bin/bash
DIR=/home/webapps/test.com/application/
FILES=(
"controllers/api/Index.php"
"config/production/routes.php"
)
for ip in $(cat iplist); do
for file in ${FILES[@]}; do
echo $ip $file
cmd="cd $DIR [ -f $file ] && cp -a $file ${file}_\`ls ${file}*|wc -l\`"
ssh $ip $cmd > /dev/null
scp ${DIR}${file} ${ip}:${DIR}${file} > /dev/null
done
done
iplist:
root@testsvr1
root@testsvr2
root@testsvr3