本文共 1205 字,大约阅读时间需要 4 分钟。
#!/bin/bash#by LCDIR=/root#DIR=/server/scriptsYUANFILE=hins423437.tar.gzBAKFILE=hins423437_xtra_20.*.tar.gzLC (){ if [ `ls -l $DIR|grep "${BAKFILE}"|wc -l` -eq 1 ] then DUYUAN=`ls -l $DIR|grep "${YUANFILE}"|awk '{print $5}'` DUBAK=`ls -l $DIR|grep "${BAKFILE}"|awk '{print $5}'` if [ ${DUBAK} -gt ${DUYUAN} ] then echo "$(date +%F_%H-%M-%S)===wait===" &>>/server/logs/hyerp_bak.log #sleep 10 sleep 30 if [ `ls -l $DIR|grep "${BAKFILE}"|awk '{print $5}'` -eq ${DUBAK} ] then /bin/sh /root/alirds.sh &>/server/logs/rds_bak.log echo "$(date +%F_%H-%M-%S)====alirds ok====" &>>/server/logs/hyerp_bak.log return else echo "$(date +%F_%H-%M-%S)====No transfer====" &>>/server/logs/hyerp_bak.log #sleep 3 sleep 60 LC fi else echo "$(date +%F_%H-%M-%S)====No transfer is completed===" &>>/server/logs/hyerp_bak.log #sleep 3 sleep 60 LC fi else echo "$(date +%F_%H-%M-%S)===cant find===" &>>/server/logs/hyerp_bak.log sleep 300 LC fi}main (){ LC echo "$(date +%F_%H-%M-%S)====EVERY THING OK====" &>>/server/logs/hyerp_bak.log}main
转载于:https://blog.51cto.com/10896311/1720495