Last active
March 20, 2018 21:03
-
-
Save igorhrq/758b1aa3c2c5c1c865dde71b72062a49 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
################################################################### | |
# ____ _ _ __ __ __ __ _ ______ __ # | |
#/ ___|| | | | \/ | \/ | / \ | _ \ \ / / # | |
#\___ \| | | | |\/| | |\/| | / _ \ | |_) \ V / # | |
# ___) | |_| | | | | | | |/ ___ \| _ < | | # | |
#|____/ \___/|_| |_|_| |_/_/ \_\_| \_\|_| # | |
# # | |
# _ ____ ____ _____ # | |
# / \ / ___/ ___|_ _| # | |
# / _ \| | | | | | # | |
# / ___ \ |__| |___ | | # | |
#V1.2 /_/ \_\____\____| |_| # | |
################################################################### | |
#!/bin/bash | |
#Script was adjusted from Summary-Acct | |
#1.1 Igor A 14/03/2018 | |
#1.2 Igor A 20/03/2018 | |
# Barra de rolagem implementada | |
# Soma de todas as contas no arquivo /home/contasUSO.txt | |
temp_txt=$(date +%N) | |
printf "\n A mente Brasileira está pensando...\n"; | |
echo -ne ' ##### (33%)\r' | |
sleep 1 | |
for i in $(cat /etc/trueuserdomains | cut -d" " -f2); do | |
limit=$(whmapi1 accountsummary user=$i | grep disklimit); | |
used=$(whmapi1 accountsummary user=$i | grep diskused | cut -d":" -f2); | |
printf "$used - $i\t$limit\n" >> $temp_txt; | |
done; | |
echo -ne ' ############# (66%)\r' | |
sleep 1 | |
cat $temp_txt | sort -n | awk {'print $3'} > /home/contas.txt; | |
cat $temp_txt | sort -n -r | awk {'print $1,$2,$3'} > /home/contasUSO.txt; | |
cat $temp_txt | sort -n -r | awk {'print $1,$2,$3'} | awk -F "M" '{n+=$1} END {print n}' | awk '{ foo = $1 / 1024 ; print foo "GB" }'>> /home/contasUSO.txt; | |
echo -ne ' ####################### (100%)\r' | |
echo -ne '\n' | |
printf "\n Salvo em /home/contas.txt apenas a lista da menor para maior"; | |
printf "\n Salvo em /home/contasUSO.txt a lista e o uso das respectivas contas\n\n"; | |
rm -f $temp_txt; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment