From 84a7c55940b2f56189091d606aa69064e8569c17 Mon Sep 17 00:00:00 2001 From: Tykayn Date: Thu, 19 Aug 2021 16:13:59 +0200 Subject: [PATCH] up script without temp file --- monitoring/check_mobilizonchaprilorg_update | 3 +-- rapport_activite/rapport_activite.sh | 2 +- upgrade/upgrade.sh | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/monitoring/check_mobilizonchaprilorg_update b/monitoring/check_mobilizonchaprilorg_update index 9e5e479..1f7d6cd 100755 --- a/monitoring/check_mobilizonchaprilorg_update +++ b/monitoring/check_mobilizonchaprilorg_update @@ -12,7 +12,6 @@ # project api for gitlab https://docs.gitlab.com/ee/api/tags.html # upgrade documentation https://docs.joinmobilizon.org/administration/upgrading/ LOCAL_REPO=/srv/mobilizon.chapril.org/live -FRAMAGIT_PROJECT_ID=20125 function usage() { @@ -23,7 +22,7 @@ function usage() { if [ "$#" -ne 0 ]; then usage else - lastVersion=$(curl -s https://framagit.org/api/v4/projects/$FRAMAGIT_PROJECT_ID/releases | jshon -a -e name > /tmp/listOfVersions.txt && sed -i -e "/rc/d" /tmp/listOfVersions.txt && cat /tmp/listOfVersions.txt |cut -d '"' -f2|grep -v '[\^\(alpha\)]'|head -n 1) + lastVersion=$(curl -s https://framagit.org/api/v4/projects/20125/releases | jshon -a -e name 2>/dev/null | sed -e "/rc/d" | cut -d '"' -f2 | grep -v '[\^\(alpha\)]'|head -n 1) currentVersion=$(cd $LOCAL_REPO && git describe --exact-match --tags $(git log -n1 --pretty='%h') |cut -c 9-100 ) # le tag se nomme ainsi "chapril-1.0.2" donc pour comparer uniquement les numéros de version on enlève le début du nom diff --git a/rapport_activite/rapport_activite.sh b/rapport_activite/rapport_activite.sh index 6a64c13..6c0b4b2 100755 --- a/rapport_activite/rapport_activite.sh +++ b/rapport_activite/rapport_activite.sh @@ -127,7 +127,7 @@ generateSpecificReport() echo "Nombre de comptes selon l'api = $(echo "$json" | jshon -e "data" -e "statistics" -e "numberOfUsers" -u)" # décompte des profils - DAY_INTERVAL=300; + DAY_INTERVAL=30000; profiles_all_time=$(sudo -u postgres -H -- psql -d mobilizon_prod -c "SELECT count(user_id) FROM actors WHERE type='Person' AND user_id is not null AND inserted_at >= ('now'::date - '$DAY_INTERVAL day'::interval )" -t | grep -v '^$' | awk '{print $1}' ) DAY_INTERVAL=30; profiles_created_last_month=$(sudo -u postgres -H -- psql -d mobilizon_prod -c "SELECT count(user_id) FROM actors WHERE type='Person' AND user_id is not null AND inserted_at >= ('now'::date - '$DAY_INTERVAL day'::interval )" -t | grep -v '^$' | awk '{print $1}' ) diff --git a/upgrade/upgrade.sh b/upgrade/upgrade.sh index ef59638..b0223a6 100644 --- a/upgrade/upgrade.sh +++ b/upgrade/upgrade.sh @@ -12,7 +12,7 @@ echo " " cd LOCAL_REPO git fetch --tags -lastVersion=$(curl -s https://framagit.org/api/v4/projects/$FRAMAGIT_PROJECT_ID/releases | jshon -a -e name > /tmp/listOfVersions.txt && sed -i -e "/rc/d" /tmp/listOfVersions.txt && cat /tmp/listOfVersions.txt |cut -d '"' -f2|grep -v '[\^\(alpha\)]'|head -n 1) +lastVersion=$(curl -s https://framagit.org/api/v4/projects/20125/releases | jshon -a -e name 2>/dev/null | sed -e "/rc/d" | cut -d '"' -f2 | grep -v '[\^\(alpha\)]'|head -n 1) currentVersion=$(cd $LOCAL_REPO && git branch | grep '*'|cut -c 3-100 ) if [ $currentVersion = $lastVersion ]; then echo " "