diff options
author | 2024-08-26 16:43:07 +0100 | |
---|---|---|
committer | 2024-08-26 19:22:42 +0200 | |
commit | 6125eb8468e088c69c2e25e6118edeacbecda33e (patch) | |
tree | 5092c03f69256f134d46828cbb3b9beaafc5f630 | |
parent | Use variables for cronjob file naming (diff) |
Amendments to mirrors cron script for reliability
-rw-r--r-- | ansible/roles/git-mirrors/templates/update-mirrors.sh.j2 | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/ansible/roles/git-mirrors/templates/update-mirrors.sh.j2 b/ansible/roles/git-mirrors/templates/update-mirrors.sh.j2 index 7e3b847..4d4579d 100644 --- a/ansible/roles/git-mirrors/templates/update-mirrors.sh.j2 +++ b/ansible/roles/git-mirrors/templates/update-mirrors.sh.j2 @@ -6,9 +6,11 @@ set -u MIRRORS_BASE_DIR="{{ git_mirrors_base_dir }}/mirrored" # Locate repositories knowing that there will be a HEAD file inside them -FOUND_REPOS=$(find "$MIRRORS_BASE_DIR" -name "HEAD" | xargs dirname) +FOUND_REPOS=$(find "$MIRRORS_BASE_DIR" -name "HEAD" -print0 | xargs -0 dirname) for repo in $FOUND_REPOS; do + pushd + cd "$repo"; echo "Updating $repo mirror..." if ! git fetch -q --prune; then @@ -16,4 +18,6 @@ for repo in $FOUND_REPOS; do exit 1 fi echo "Updated repository." + + popd done |