Skip to content

Instantly share code, notes, and snippets.

@rushipkar90
Created September 25, 2015 16:12
Show Gist options
  • Save rushipkar90/4c3dc7188c414fe2e4d1 to your computer and use it in GitHub Desktop.
Save rushipkar90/4c3dc7188c414fe2e4d1 to your computer and use it in GitHub Desktop.
accountdetails.sh
#/bin/bash
echo > accountdetails;
read -p "Enter the Post Migration username : " prompt
echo "===========================" >> accountdetails;
echo "----- Account Size -----" >> accountdetails;
echo "===========================" >> accountdetails;
du -sh /home/$prompt >> accountdetails;
du -sm /home/$prompt >> accountdetails;
echo "===========================" >> accountdetails;
echo "----- File Count -------" >> accountdetails;
echo "===========================" >> accountdetails;
files=`ls -la * -R /home/$prompt | wc -l`
echo "Files:" "" "$files" >> accountdetails;
echo "===========================" >> accountdetails;
konta=`ls -ld /var/lib/mysql/"$prompt"_* | awk '{print $9}'`;
#echo "$konta"
echo "===========================" >> accountdetails;
echo "---Database----" >> accountdetails;
echo "===========================" >> accountdetails;
for i in "$konta"; do
#if [ -n "$knota" ]; then
data1=`du -sh $konta`;
echo "$data1" >> accountdetails;
#fi
done
echo "===========================" >> accountdetails;
echo "---------- Domain Dns------" >> accountdetails;
echo "----------------------------" >> accountdetails;
for j in `cat /var/cpanel/users/$prompt | grep -i dns | grep -v XDNS | cut -d = -f2`; do
dnsmi=`dig A "$j" +short`;
echo "$j" "$dnsmi" >> accountdetails;
done
echo "===========================" >> accountdetails;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment