update_server.sh
#!/bin/sh
#first mkdir test in server and client ,chmod -R 777 test
read -p "input source directory:" sdir
read -p "input destination directory:" ddir
dir=/data/www/test
dirid=/root
alone (){
read -p "input client ip:" ip
/usr/bin/rsync -avz --delete $dir/$sdir/ $ip:$dir/$ddir
ssh $ip "su - root '$dirid/client.sh'"
}
all (){
for i in `cat ip.txt`
do
/usr/bin/rsync -avz --delete $dir/$sdir/ $i:$dir/$ddir
ssh $i "su - root '$dirid/client.sh'"
done
}
case $1 in
alone)
alone
;;
all)
all
;;
*)
exit 1
esac
update_client.sh
#!/bin/sh
for i in `ls /data/www/test`
do
rsync -avz /data/www/test/$i/ --delete /data/www/$i
chmod -R 755 /data/www/$i
chown -R /data/www/$i
rm -rf /data/www/test/$i
done
因为server在是腾讯平台,所以实际情况需要考虑到权限问题
阅读(1203) | 评论(0) | 转发(0) |