From 47d9c3a2b2da188ec0ddcf1df43b20161351b9db Mon Sep 17 00:00:00 2001 From: Martial Maillot Date: Tue, 7 Nov 2023 09:41:01 +0100 Subject: [PATCH] feat: detect error on sh scripts --- package.json | 2 +- scripts/download_dump.sh | 3 +++ scripts/download_dump_precise_date.sh | 3 +++ scripts/dump_matomo_precise_date.sh | 4 ++++ scripts/dump_matomo_yesterday.sh | 4 ++++ scripts/get_last_month_cache.sh | 3 +++ 6 files changed, 18 insertions(+), 1 deletion(-) mode change 100644 => 100755 scripts/download_dump_precise_date.sh diff --git a/package.json b/package.json index b23f3dd6..d388192e 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ "lint": "eslint src/ --ext .ts --fix", "test": "CDTN_API_URL=https://code-du-travail-numerique-preprod.dev.fabrique.social.gouv.fr jest", "test-one": "jest analysis --watch", - "monolog": "node -r ts-node/register --max-old-space-size=28000 src/bin/index.ts", + "monolog": "node -r ts-node/register --max-old-space-size=45000 src/bin/index.ts", "build": "yarn run build:bin && yarn run build:lib", "build:bin": "yarn run ncc build src/bin/index.ts -o bin", "build:lib": "yarn tsc -p src/tsconfig.lib.json", diff --git a/scripts/download_dump.sh b/scripts/download_dump.sh index a7a17512..a14dce92 100755 --- a/scripts/download_dump.sh +++ b/scripts/download_dump.sh @@ -1,5 +1,8 @@ #!/bin/bash +# Exit on error +set -e + mkdir data date=`date -d "@$(($(date +%s) - 86400))" "+%Y-%m-%d"` diff --git a/scripts/download_dump_precise_date.sh b/scripts/download_dump_precise_date.sh old mode 100644 new mode 100755 index 85e0e0ee..ac6cbcda --- a/scripts/download_dump_precise_date.sh +++ b/scripts/download_dump_precise_date.sh @@ -1,5 +1,8 @@ #!/bin/bash +# Exit on error +set -e + mkdir data date=$1 diff --git a/scripts/dump_matomo_precise_date.sh b/scripts/dump_matomo_precise_date.sh index f42375db..e60a586c 100755 --- a/scripts/dump_matomo_precise_date.sh +++ b/scripts/dump_matomo_precise_date.sh @@ -1,4 +1,8 @@ #!/bin/bash + +# Exit on error +set -e + limit=100 offset=0 accu="[]" diff --git a/scripts/dump_matomo_yesterday.sh b/scripts/dump_matomo_yesterday.sh index e60a232d..22fbc505 100755 --- a/scripts/dump_matomo_yesterday.sh +++ b/scripts/dump_matomo_yesterday.sh @@ -1,4 +1,8 @@ #!/bin/bash + +# Exit on error +set -e + date=`date -d "@$(($(date +%s) - 86400))" "+%Y-%m-%d"` # date=`gdate -d "@$(($(gdate +%s) - 86400))" "+%Y-%m-%d"` # to run locally on macosx # date=2021-11-02 diff --git a/scripts/get_last_month_cache.sh b/scripts/get_last_month_cache.sh index 7d723505..ff51a380 100755 --- a/scripts/get_last_month_cache.sh +++ b/scripts/get_last_month_cache.sh @@ -1,5 +1,8 @@ #!/bin/bash +# Exit on error +set -e + DATA_FOLDER="data-queries" if [ -z "$1" ]; then