23
0
Fork 0

up script without temp file

This commit is contained in:
Tykayn 2021-08-19 16:13:59 +02:00 committed by tykayn
parent 3bcbae2ca7
commit 84a7c55940
3 changed files with 3 additions and 4 deletions

View File

@ -12,7 +12,6 @@
# project api for gitlab https://docs.gitlab.com/ee/api/tags.html # project api for gitlab https://docs.gitlab.com/ee/api/tags.html
# upgrade documentation https://docs.joinmobilizon.org/administration/upgrading/ # upgrade documentation https://docs.joinmobilizon.org/administration/upgrading/
LOCAL_REPO=/srv/mobilizon.chapril.org/live LOCAL_REPO=/srv/mobilizon.chapril.org/live
FRAMAGIT_PROJECT_ID=20125
function usage() { function usage() {
@ -23,7 +22,7 @@ function usage() {
if [ "$#" -ne 0 ]; then if [ "$#" -ne 0 ]; then
usage usage
else 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 ) 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 # 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

View File

@ -127,7 +127,7 @@ generateSpecificReport()
echo "Nombre de comptes selon l'api = $(echo "$json" | jshon -e "data" -e "statistics" -e "numberOfUsers" -u)" echo "Nombre de comptes selon l'api = $(echo "$json" | jshon -e "data" -e "statistics" -e "numberOfUsers" -u)"
# décompte des profils # 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}' ) 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; 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}' ) 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}' )

View File

@ -12,7 +12,7 @@ echo " "
cd LOCAL_REPO cd LOCAL_REPO
git fetch --tags 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 ) currentVersion=$(cd $LOCAL_REPO && git branch | grep '*'|cut -c 3-100 )
if [ $currentVersion = $lastVersion ]; then if [ $currentVersion = $lastVersion ]; then
echo " " echo " "