From bbef4b35879d6027e0f26ca02c83ef154bebe653 Mon Sep 17 00:00:00 2001 From: Hugo Lecuyer Date: Thu, 29 Aug 2024 11:41:24 +0200 Subject: [PATCH] fix after victor's comments 2 --- api/cron.json | 6 +++--- api/execute_and_notify.sh | 1 - 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/api/cron.json b/api/cron.json index 97dfa4dd4..067cfc739 100644 --- a/api/cron.json +++ b/api/cron.json @@ -1,15 +1,15 @@ { "jobs": [ { - "command": "30 * * * * TQDM_DISABLE=1 test $ENV = 'prod' && sh run_management_command.sh data-inclusion-api load_inclusion_data", + "command": "30 * * * * TQDM_DISABLE=1 test $ENV = 'prod' && sh execute_and_notify.sh data-inclusion-api load_inclusion_data", "size": "XL" }, { - "command": "30 * * * * TQDM_DISABLE=1 test $ENV != 'prod' && sh run_management_command.sh data-inclusion-api load_inclusion_data", + "command": "30 * * * * TQDM_DISABLE=1 test $ENV != 'prod' && data-inclusion-api load_inclusion_data", "size": "S" }, { - "command": "0 4 * * * sh run_management_command.sh vacuumdb --full --analyze --verbose --table api__structures --table api__services $DATABASE_URL", + "command": "0 4 * * * sh execute_and_notify.sh vacuumdb --full --analyze --verbose --table api__structures --table api__services $DATABASE_URL", "size": "S" } ] diff --git a/api/execute_and_notify.sh b/api/execute_and_notify.sh index e7b8d41b7..6276d8b54 100644 --- a/api/execute_and_notify.sh +++ b/api/execute_and_notify.sh @@ -7,7 +7,6 @@ wait $command_pid exit_code=$? if [ $exit_code -ne 0 ] && [ "$ENV" = "prod" ]; then - # Execute the curl command in case of an error escaped_command="\`$@\`" echo "Error with exit code \`$exit_code\` in command $escaped_command, sending message to Mattermost" curl -i -X POST -H "Content-Type: application/json" -d "{\"text\": \"Error with exit code \`$exit_code\` in command $escaped_command: \nLogs: \`scalingo --region osc-secnum-fr1 --app data-inclusion-api-prod logs --lines 1000 -F $CONTAINER -f\`\"}" $MATTERMOST_HOOK