Cpanel create test accounts

From Cheatsheet
Jump to navigation Jump to search

Use this to create several cpanel test accounts at once.

Answer the questions and go!

no output:

read -p "Number of accounts to create?" numACCts; read -p "Password to use on all accounts?" acctPaSsWd; CHARS=( q a z w s x e d c r f v t g b y h n u j m i k o l p ); MODNUM=${#CHARS[*]}; LYELLOW=$(echo -en '\033[01;33m'); CYAN=$(echo -en '\033[00;36m'); RESTORE=$(echo -en '\033[0m'); acctcount=0; for i in `eval echo {1..$numACCts}`; do(( acctcount=acctcount+1 )); USRSTR=""; USRLEN=0; for q in {0..7}; do INDEX=$(($RANDOM%$MODNUM)); USRSTR="${USRSTR}${CHARS[$INDEX]}"; done; yes | /scripts/createacct ${USRSTR}.iter $USRSTR $acctPaSsWd > /dev/null 2>&1; echo -ne ${CYAN}"Creating your test accounts:" ${LYELLOW}"$acctcount/$numACCts\033[0K\r"${RESTORE}; done; echo

Domain and user output:

read -p "Number of accounts to create?" numACCts; read -p "Password to use on all accounts?" acctPaSsWd; CHARS=( q a z w s x e d c r f v t g b y h n u j m i k o l p ); MODNUM=${#CHARS[*]}; LYELLOW=$(echo -en '\033[01;33m'); CYAN=$(echo -en '\033[00;36m'); RESTORE=$(echo -en '\033[0m'); > /tmp/testAccounts.txt; acctcount=0; for i in `eval echo {1..$numACCts}`; do(( acctcount=acctcount+1 )); USRSTR=""; USRLEN=0; for q in {0..7}; do INDEX=$(($RANDOM%$MODNUM)); USRSTR="${USRSTR}${CHARS[$INDEX]}"; done; yes | /scripts/createacct ${USRSTR}.iter $USRSTR $acctPaSsWd > /dev/null 2>&1; echo ${CYAN}"Domain info:" ${LYELLOW}"${USRSTR}.iter" ${CYAN}"User:" ${LYELLOW}"$USRSTR"${RESTORE} >> /tmp/testAccounts.txt ; echo -ne ${CYAN}"Creating your test accounts:" ${LYELLOW}"$acctcount/$numACCts\033[0K\r"${RESTORE}; done; echo; cat /tmp/testAccounts.txt