Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F61525269
repo-size.sh
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Tue, May 7, 05:22
Size
657 B
Mime Type
text/x-shellscript
Expires
Thu, May 9, 05:22 (2 d)
Engine
blob
Format
Raw Data
Handle
17363221
Attached To
rPHINFRA c4science
repo-size.sh
View Options
#!/bin/bash
ssh c4science-backup du --max-depth=1 /backup/repo/ | tee /tmp/repo-size.log
SIZE=$(cat /tmp/repo-size.log)
SORT=$(echo "$SIZE" | sort -n)
LIMIT=2 #GB
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-)
info=$(./get_repo_info.sh $repo | tail -n 1)
echo -n "| $(echo $size | numfmt --to=iec --suffix=B) "
echo -n "| R$repo | "
echo "$info" | sed 's/\t/ | /g'
fi
done <<< "$SORT"
Event Timeline
Log In to Comment