From b0d915e8815577ecebc464d39a9dfcb0aa1381e9 Mon Sep 17 00:00:00 2001 From: Benoit S Date: Sun, 29 Aug 2021 10:45:51 +0900 Subject: [PATCH] More wrapping --- tootpaste.sh | 58 +++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 48 insertions(+), 10 deletions(-) diff --git a/tootpaste.sh b/tootpaste.sh index a18c3d3..e973e6f 100644 --- a/tootpaste.sh +++ b/tootpaste.sh @@ -28,8 +28,15 @@ PREV_ERRORS_LOG=/tmp/tootpaste_prev_errors accounts_cull() { - $DRY_RUN && $TOOTCTL accounts cull --dry-run --concurrency "$DB_POOL" > "$CULL_LOG" - $DRY_RUN || $TOOTCTL accounts cull --concurrency "$DB_POOL" > "$CULL_LOG" + $DRY_RUN \ + && $TOOTCTL accounts cull \ + --dry-run \ + --concurrency "$DB_POOL" \ + > "$CULL_LOG" + $DRY_RUN \ + || $TOOTCTL accounts cull \ + --concurrency "$DB_POOL" \ + > "$CULL_LOG" # Remove instances that have an expired certificate from more than # TLS_EXPIRED_MAX_SEC @@ -55,8 +62,15 @@ accounts_cull() { DATE_DIFF=$(($(date +%s) - TLS_EXPIRED_TS)) if [[ $DATE_DIFF -gt $TLS_EXPIRED_MAX_SEC ]]; then echo "${instance} has a certificate expired for more than TLS_EXPIRED_MAX_SEC, purging..." - $DRY_RUN && $TOOTCTL domains purge --concurrency "$DB_POOL" --dry-run "$instance" - $DRY_RUN || $TOOTCTL domains purge --concurrency "$DB_POOL" "$instance" + $DRY_RUN \ + && $TOOTCTL domains purge \ + --concurrency "$DB_POOL" \ + --dry-run \ + "$instance" + $DRY_RUN \ + || $TOOTCTL domains purge \ + --concurrency "$DB_POOL" \ + "$instance" fi done < "$TLS_EXPIRED_LOG" @@ -86,8 +100,15 @@ accounts_cull() { || error=true if $error; then echo "${instance} still cannot be accessed, purging..." - $DRY_RUN && $TOOTCTL domains purge --concurrency "$DB_POOL" --dry-run "$instance" - $DRY_RUN || $TOOTCTL domains purge --concurrency "$DB_POOL" "$instance" + $DRY_RUN \ + && $TOOTCTL domains purge \ + --concurrency "$DB_POOL" \ + --dry-run \ + "$instance" + $DRY_RUN \ + || $TOOTCTL domains purge \ + --concurrency "$DB_POOL" \ + "$instance" fi fi done < "$OTHER_ERRORS_LOG" @@ -103,13 +124,30 @@ cache_recount(){ media_remove(){ - $DRY_RUN && $TOOTCTL media remove --days "$MEDIA_REMOVE_DAYS" --concurrency "$DB_POOL" --dry-run - $DRY_RUN || $TOOTCTL media remove --days "$MEDIA_REMOVE_DAYS" --concurrency "$DB_POOL" + $DRY_RUN \ + && $TOOTCTL media remove \ + --days "$MEDIA_REMOVE_DAYS" \ + --concurrency "$DB_POOL" \ + --dry-run + $DRY_RUN \ + || $TOOTCTL media remove \ + --days "$MEDIA_REMOVE_DAYS" \ + --concurrency "$DB_POOL" $DRY_RUN && $TOOTCTL media remove-orphans --dry-run $DRY_RUN || $TOOTCTL media remove-orphans - $DRY_RUN && $TOOTCTL preview_cards remove --days "$MEDIA_REMOVE_DAYS" --concurrency "$DB_POOL" --dry-run - $DRY_RUN || $TOOTCTL preview_cards remove --days "$CARDS_REMOVE_DAYS" --concurrency "$DB_POOL" --link + + $DRY_RUN \ + && $TOOTCTL preview_cards remove \ + --days "$MEDIA_REMOVE_DAYS" \ + --concurrency "$DB_POOL" \ + --link \ + --dry-run + $DRY_RUN \ + || $TOOTCTL preview_cards remove \ + --days "$CARDS_REMOVE_DAYS" \ + --concurrency "$DB_POOL" \ + --link } statuses_remove(){