diff options
Diffstat (limited to 'docs/how-to/migration-scripts/31-extract-purgatory-expiry.sh')
| -rwxr-xr-x | docs/how-to/migration-scripts/31-extract-purgatory-expiry.sh | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/docs/how-to/migration-scripts/31-extract-purgatory-expiry.sh b/docs/how-to/migration-scripts/31-extract-purgatory-expiry.sh index a603a1e..a0c8ad0 100755 --- a/docs/how-to/migration-scripts/31-extract-purgatory-expiry.sh +++ b/docs/how-to/migration-scripts/31-extract-purgatory-expiry.sh | |||
| @@ -356,7 +356,7 @@ main() { | |||
| 356 | parsed=$(parse_log_line "$line") | 356 | parsed=$(parse_log_line "$line") |
| 357 | if [[ -n "$parsed" ]]; then | 357 | if [[ -n "$parsed" ]]; then |
| 358 | echo "$parsed" >> "$output_file" | 358 | echo "$parsed" >> "$output_file" |
| 359 | ((count++)) | 359 | count=$((count + 1)) |
| 360 | fi | 360 | fi |
| 361 | done <<< "$raw_lines" | 361 | done <<< "$raw_lines" |
| 362 | 362 | ||
| @@ -374,9 +374,10 @@ main() { | |||
| 374 | if [[ $count -gt 0 ]]; then | 374 | if [[ $count -gt 0 ]]; then |
| 375 | echo "" | 375 | echo "" |
| 376 | log_info "Sample entries (first 5):" | 376 | log_info "Sample entries (first 5):" |
| 377 | tail -n +5 "$output_file" | head -5 | while IFS=$'\t' read -r repo npub timestamp reason; do | 377 | # Use a subshell to avoid SIGPIPE issues with set -e |
| 378 | (tail -n +5 "$output_file" | head -5 | while IFS=$'\t' read -r repo npub timestamp reason; do | ||
| 378 | echo " repo=$repo npub=${npub:0:20}... timestamp=$timestamp" | 379 | echo " repo=$repo npub=${npub:0:20}... timestamp=$timestamp" |
| 379 | done | 380 | done) || true |
| 380 | fi | 381 | fi |
| 381 | 382 | ||
| 382 | # Show unique repos affected | 383 | # Show unique repos affected |
| @@ -388,9 +389,10 @@ main() { | |||
| 388 | 389 | ||
| 389 | echo "" | 390 | echo "" |
| 390 | log_info "Repositories with purgatory expiry:" | 391 | log_info "Repositories with purgatory expiry:" |
| 391 | tail -n +5 "$output_file" | awk -F'\t' '{print $1}' | sort | uniq -c | sort -rn | head -10 | while read -r cnt repo; do | 392 | # Use a subshell to avoid SIGPIPE issues with set -e |
| 393 | (tail -n +5 "$output_file" | awk -F'\t' '{print $1}' | sort | uniq -c | sort -rn | head -10 | while read -r cnt repo; do | ||
| 392 | echo " $repo: $cnt expiry events" | 394 | echo " $repo: $cnt expiry events" |
| 393 | done | 395 | done) || true |
| 394 | 396 | ||
| 395 | local total_repos | 397 | local total_repos |
| 396 | total_repos=$(tail -n +5 "$output_file" | awk -F'\t' '{print $1}' | sort -u | wc -l) | 398 | total_repos=$(tail -n +5 "$output_file" | awk -F'\t' '{print $1}' | sort -u | wc -l) |
| @@ -398,6 +400,9 @@ main() { | |||
| 398 | echo " ... and $((total_repos - 10)) more repositories" | 400 | echo " ... and $((total_repos - 10)) more repositories" |
| 399 | fi | 401 | fi |
| 400 | fi | 402 | fi |
| 403 | |||
| 404 | # Explicit success exit | ||
| 405 | exit 0 | ||
| 401 | } | 406 | } |
| 402 | 407 | ||
| 403 | main "$@" | 408 | main "$@" |