From c5d64e621e346069fafe88b4e05c64bbdfcfe1ce Mon Sep 17 00:00:00 2001 From: localhost_frssoft Date: Thu, 14 Apr 2022 13:48:58 +0300 Subject: [PATCH] Fix backup conditions --- pleroma-cli.sh | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/pleroma-cli.sh b/pleroma-cli.sh index c4abdeb..7667446 100755 --- a/pleroma-cli.sh +++ b/pleroma-cli.sh @@ -147,7 +147,9 @@ follow_api_export() while [ $count -gt 0 ]; do followings=$(followings_api_get $acc_id) count=$(echo $followings | jj \#) - if [ $count -lt 40 ]; then + if [ $count -eq 0 ]; then + echo "$acc_following_count followings exported" + elif [ $count -lt 40 ]; then countindex=$(expr $count - 1) echo $followings | jj -l \#.acct | sed 's/"//g' | legacy_addr_preprocess >> backups_$instance/friends.csv offset=$(echo $followings | jj $countindex.id) @@ -159,8 +161,6 @@ follow_api_export() echo $followings | jj -l \#.acct | sed 's/"//g' | legacy_addr_preprocess >> backups_$instance/friends.csv offset=$(echo $followings | jj $countindex.id) echo "+$count follows" - else - echo "$acc_following_count followings exported" fi sleep 1 done @@ -173,7 +173,9 @@ blocks_api_export() while [ $count -gt 0 ]; do blocks=$(blocks_api_get) count=$(echo $blocks | jj \#) - if [ $count -lt 40 ]; then + if [ $count -eq 0 ]; then + echo "Blocks exported" + elif [ $count -lt 40 ]; then countindex=$(expr $count - 1) echo $blocks | jj -l \#.acct | sed 's/"//g' | legacy_addr_preprocess >> backups_$instance/blocks.csv offset=$(echo $blocks | jj $countindex.id) @@ -184,8 +186,6 @@ blocks_api_export() echo $blocks | jj -l \#.acct | sed 's/"//g' | legacy_addr_preprocess >> backups_$instance/blocks.csv offset=$(echo $blocks | jj $countindex.id) echo "+$count blocks" - else - echo "Blocks exported" fi sleep 1 done @@ -198,7 +198,9 @@ mutes_api_export() while [ $count -gt 0 ]; do mutes=$(mutes_api_get) count=$(echo $mutes | jj \#) - if [ $count -lt 40 ]; then + if [ $count -eq 0 ]; then + echo "Mutes exported" + elif [ $count -lt 40 ]; then countindex=$(expr $count - 1) echo $mutes | jj -l \#.acct | sed 's/"//g' | legacy_addr_preprocess >> backups_$instance/mutes.csv offset=$(echo $mutes | jj $countindex.id) @@ -209,8 +211,6 @@ mutes_api_export() echo $mutes | jj -l \#.acct | sed 's/"//g' | legacy_addr_preprocess >> backups_$instance/mutes.csv offset=$(echo $mutes | jj $countindex.id) echo "+$count mutes" - else - echo "Mutes exported" fi sleep 1 done