More wrapping

This commit is contained in:
Benoit S 2021-08-29 10:45:51 +09:00
parent 209ff72416
commit b0d915e881

View file

@ -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(){