admin scripts
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

23 lines
507 B

  1. #!/bin/bash
  2. date=$(date +%Y%m%d)
  3. success=0
  4. loops=0
  5. while [ $success -eq 0 ]; do
  6. success=$(grep -c success /backup/mysql/"$date"/summary)
  7. if [ "$success" -gt 0 ]; then
  8. files=$(find /backup/mysql/"$date"/tree/dumps/ -type f -printf "%P \n")
  9. for file in $files; do
  10. username=${file%.sql}
  11. group=$(id -g "$username")
  12. chown "$username":"$group" /backup/mysql/"$date"/tree/dumps/"$file"
  13. done
  14. elif [ $loops -gt 12 ]; then
  15. exit 1
  16. else
  17. $loops++
  18. sleep 1800
  19. fi
  20. done