Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2020
21
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. #!/bin/sh
  2. PATH=/etc:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/etc:/usr/local/bin:/usr/local/sbin
  3.  
  4. set -x
  5.  
  6. dir_log="/var/log/rsync/"
  7. file_log="${dir_log}rsync-config-OVH-storage.log"
  8.  
  9. speed_limit=90000 # in KB/s
  10.  
  11. [ ! -d ${dir_log} ] && { mkdir -p ${dir_log}; }
  12.  
  13. cd /root/script/rsync
  14.  
  15. while [ 1 ]
  16. do
  17. /usr/local/bin/flock -xno -E 1 /var/run/backup-config-OVH-storage.lock \
  18. /usr/local/bin/sshpass -f ovh_storage.pass \
  19. rsync -ravu -L --bwlimit=${speed_limit} \
  20. --log-file=${file_log} \
  21. /backup/config-rsync/ [email protected]:server-config/cdn.XXXXX/config
  22.  
  23. if [ "$?" = "0" ] ; then
  24. echo "rsync completed normally" | tee -a ${file_log}
  25. exit 1
  26. else
  27. echo "Rsync failure. Backing off and retrying..." | tee -a ${file_log}
  28. sleep 30
  29. fi
  30. done
  31.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement