shell 同步 learn
shell sync
#!/bin/bash sshpass -p 'test888' rsync -avzP -e 'ssh' /data/test/server/ms/uploadFiles/file/ [email protected]:/data/test/web/generate if [ "$?" = '0' ];then echo "RSYNC 192.168.1.30 server /data/test/web/generate ...OK" else dates=`date +%Y-%m-%d:%S` echo "RSYNC 192.168.1.30 server /data/test/web/generate ...false" echo "$dates Rsync fasle" > /tmp/false.txt fi rsync -avzP /data/test/server/ms/uploadFiles/file/ /data/test/web/generate if [ "$?" = '0' ];then echo "RSYNC local server /data/test/web/generate ...OK" else dates1=`date +%Y-%m-%d:%S` echo "$dates1 Rsync fasle" >> /tmp/false.txt echo "RSYNC local server /data/test/web/generate ...false" fi # rsync feedback sshpass -p 'test888' rsync -avzP -e 'ssh' /data/test/server/api/upload/feedback/ [email protected]:/data/test/web/generate/images if [ "$?" = '0' ];then echo "RSYNC 192.168.1.30 server /data/test/web/generate/images ...OK" else dates=`date +%Y-%m-%d:%S` echo "RSYNC 192.168.1.30 server /data/test/web/generate/images ...false" echo "$dates Rsync fasle" > /tmp/false.txt fi rsync -avzP /data/test/server/api/upload/feedback/ /data/test/web/generate/images if [ "$?" = '0' ];then echo "RSYNC local server /data/test/web/generate/images ...OK" else dates1=`date +%Y-%m-%d:%S` echo "$dates1 Rsync fasle" >> /tmp/false.txt echo "RSYNC local server /data/test/web/generate/images ...false" fi # rsync unbinding sshpass -p 'test888' rsync -avzP -e 'ssh' /data/test/server/api/upload/unbinding/ [email protected]:/data/test/web/generate/images if [ "$?" = '0' ];then echo "RSYNC 192.168.1.30 server /data/test/web/generate/images ...OK" else dates=`date +%Y-%m-%d:%S` echo "RSYNC 192.168.1.30 server /data/test/web/generate/images ...false" echo "$dates Rsync fasle" > /tmp/false.txt fi rsync -avzP /data/test/server/api/upload/unbinding/ /data/test/web/generate/images if [ "$?" = '0' ];then echo "RSYNC local server /data/test/web/generate/images ...OK" else dates1=`date +%Y-%m-%d:%S` echo "$dates1 Rsync fasle" >> /tmp/false.txt echo "RSYNC local server /data/test/web/generate/images ...false" fi # rsync upload1 sshpass -p 'test888' rsync -avzP -e 'ssh' /data/test/server/ms/plugins/ueditor/jsp/upload1/ [email protected]:/data/test/web/generate/images if [ "$?" = '0' ];then echo "RSYNC 192.168.1.30 server /data/test/web/generate/images ...OK" else dates=`date +%Y-%m-%d:%S` echo "RSYNC 192.168.1.30 server /data/test/web/generate/images ...false" echo "$dates Rsync fasle" > /tmp/false.txt fi rsync -avzP /data/test/server/ms/plugins/ueditor/jsp/upload1/ /data/test/web/generate/images if [ "$?" = '0' ];then echo "RSYNC local server /data/test/web/generate/images ...OK" else dates1=`date +%Y-%m-%d:%S` echo "$dates1 Rsync fasle" >> /tmp/false.txt echo "RSYNC local server /data/test/web/generate/images ...false" fi # rsync images rsync -avzP /data/test/server/api/upload/ /data/test/server/ms/api_upload if [ "$?" = '0' ];then echo "RSYNC local server /data/test/web/generate ...OK" else dates1=`date +%Y-%m-%d:%S` echo "$dates1 Rsync fasle" >> /tmp/false.txt echo "RSYNC local server /data/test/web/generate ...false" fi # rsync images sshpass -p 'test888' rsync -avzP -e 'ssh' [email protected]:/data/test/server/api/upload/ /data/test/server/ms/api_upload if [ "$?" = '0' ];then echo "RSYNC 192.168.1.30 server /data/test/server/ms/api_upload ...OK" else dates=`date +%Y-%m-%d:%S` echo "RSYNC 192.168.1.30 server /data/test/web/generate ...false" echo "$dates Rsync fasle" > /tmp/false.txt fi #sendmail alarm if [ ! -f '/tmp/false' ];then : else mail -s "Rsync data false" [email protected] < /tmp/false.txt rm -f /tmp/false.txt fi
相关推荐
tianhuak 2020-11-24
huha 2020-10-16
lianshaohua 2020-09-23
laisean 2020-11-11
zhangjie 2020-11-11
大牛牛 2020-10-30
firefaith 2020-10-30
liguojia 2020-10-20
wangzhaotongalex 2020-10-20
以梦为马不负韶华 2020-10-20
CARBON 2020-10-20
彼岸随笔 2020-10-20
lianshaohua 2020-10-20
yutou0 2020-10-17
JohnYork 2020-10-16
xiaonamylove 2020-10-16
Julyth 2020-10-16
applecarelte 2020-10-16
ourtimes 2020-10-16