Created
March 9, 2016 06:35
-
-
Save rushipkar90/5a9e55ca21a91763b3a9 to your computer and use it in GitHub Desktop.
Multipleaccountdetails
This file contains hidden or 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
#/bin/bash | |
echo > accountdetails; | |
#soho_accounts.txt must exists with list of cpanel usernames | |
for i in `cat soho_accounts.txt` ; do | |
{ | |
#read -p "Enter the Post Migration username : " prompt | |
echo "(===========================" >> accountdetails; | |
echo "----- Account Size -----" >> accountdetails; | |
echo "===========================" >> accountdetails; | |
du -sh /home/$i >> accountdetails; | |
du -sm /home/$i >> accountdetails; | |
echo "===========================" >> accountdetails; | |
echo "----- File Count -------" >> accountdetails; | |
echo "===========================" >> accountdetails; | |
files=`ls -la * -R /home/$i | wc -l` | |
echo "Files:" "" "$files" >> accountdetails; | |
echo "===========================" >> accountdetails; | |
konta=`ls -ld /var/lib/mysql/"$i"_* | awk '{print $9}'`; | |
#echo "$konta" | |
echo "===========================" >> accountdetails; | |
echo "---Database----" >> accountdetails; | |
echo "===========================" >> accountdetails; | |
for j in "$konta"; do | |
#if [ -n "$knota" ]; then | |
data1=`du -sh $j`; | |
echo "$data1" >> accountdetails; | |
#fi | |
done | |
echo "===========================" >> accountdetails; | |
echo "---------- Domain Dns------" >> accountdetails; | |
echo "----------------------------" >> accountdetails; | |
for k in `cat /var/cpanel/users/$i | grep -i dns | grep -v XDNS | cut -d = -f2`; do | |
dnsmi=`dig A "$k" +short`; | |
echo "$k" "$dnsmi" >> accountdetails; | |
done | |
echo "===========================" >> accountdetails; | |
echo "" >> accountdetails; | |
echo "" >> accountdetails; | |
} | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment