diff --git a/utils/get_repo_author.sh b/utils/get_repo_author.sh deleted file mode 100755 index d5b3b6c..0000000 --- a/utils/get_repo_author.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash - -REPO_ID=$1 -DB="phabricator_repository" -HOST="c4science-db01" - -SQL="select u.username, u.email from phabricator_repository.repository_transaction as t, phabricator_repository.repository as r, phabricator_user.user_externalaccount as u where u.username is not NULL and u.userPHID=t.authorPHID and r.phid=t.objectPHID and r.id=$REPO_ID and t.transactionType='core:create' limit 1;" - -ssh -n $HOST "mysql -B -e \"$SQL\" $DB" diff --git a/utils/get_repo_info.sh b/utils/get_repo_info.sh new file mode 100755 index 0000000..a3dae8e --- /dev/null +++ b/utils/get_repo_info.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +REPO_ID=$1 +DB="phabricator_repository" +HOST="c4science-db01" + +SQL="select r.name, u.username, u.email from phabricator_repository.repository_transaction as t, phabricator_repository.repository as r, phabricator_user.user_externalaccount as u where u.username is not NULL and u.userPHID=t.authorPHID and r.phid=t.objectPHID and r.id=$REPO_ID and t.transactionType='core:create' limit 1;" + +ssh -n $HOST "mysql -B -e \"$SQL\" $DB" diff --git a/utils/repo-size.sh b/utils/repo-size.sh index 7b0a40f..296d046 100755 --- a/utils/repo-size.sh +++ b/utils/repo-size.sh @@ -1,21 +1,20 @@ #!/bin/bash SIZE=$(ssh c4science-backup du --max-depth=1 /backup/repo/) #SIZE=$(cat /tmp/size) SORT=$(echo "$SIZE" | sort -n) LIMIT=2 #GB -echo '| size | repo | username | email' -echo '| --- | --- | --- | ---' +echo '| size | repo id | repo name | username | email' +echo '| --- | --- | --- | --- | ---' while read -r i; do size=$(echo $i | awk '{print $1,"*1024"}' | bc ) if [ "$size" -gt "$(($LIMIT*1024*1024*1024))" ]; then repo=$(echo $i | awk '{print $2}' | cut -c 14-) - author=$(./get_repo_author.sh $repo | tail -n 1) - + info=$(./get_repo_info.sh $repo | tail -n 1) echo -n "| $(echo $size | numfmt --to=iec --suffix=B) " echo -n "| R$repo " - echo $author | awk '{print "| ",$1," | ",$2}' + echo $info | awk '{print "| ",$1," | ",$2," | ",$3}' fi done <<< "$SORT"