From 68cd1bb65473296e4f2058ac30e58eefbc4ffda1 Mon Sep 17 00:00:00 2001 From: Claudemir Todo Bom Date: Sat, 5 Oct 2024 08:35:20 -0300 Subject: [PATCH] clear imported whatsapp sessions --- backend/scripts/load-retrieved.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/backend/scripts/load-retrieved.sh b/backend/scripts/load-retrieved.sh index d9153de..340dc03 100755 --- a/backend/scripts/load-retrieved.sh +++ b/backend/scripts/load-retrieved.sh @@ -71,4 +71,15 @@ for input_file in "$INPUT_DIR"/*.csv; do echo "Error importing data from $input_file into table '$table'." fi done + +echo "Clearing Whatsapp Sessions" +PGPASSWORD="${DB_PASS}" psql -h "${DB_HOST}" -U "${DB_USER}" -d "${DB_NAME}" -c "UPDATE \"Whatsapps\" SET session='', status='CLOSED'" &> /tmp/clearwhatsapps.log + +if [ $? -gt 0 ]; then + echo "Error clearing Whatsapp sessions:" + cat /tmp/clearwhatsapps.log + exit 100 +fi + + exit 1