Jump to content
Slate Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate Marble
Slate Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate Marble
NukeNick

cPanel - List all mailboxes on VPS

Recommended Posts

Dirty lil' pr1ck, αλλά τη δουλειά του την κάνει. Θα ανεβάσω με μορφοποίηση μόλις προλάβω να ασχοληθώ:

 

OWNER=$@
KONTA=`ls -1A /var/cpanel/users/`

count=1
for x in `echo -n "$KONTA"`;do
  wiersz=`grep -i ^dns /var/cpanel/users/"$x" |cut -d= -f2`
  DOMAIN[$count]=$wiersz
  count=$[$count+1]
  echo "Login:        `echo "$x"`"


    for i in `echo "${DOMAIN[@]}" | sed  's/ /\n/g'`;do
      for n in ` ls -A /home/"$x"/mail/"$i"/ 2>/dev/null`;do

           if   [ "$n" == "cur" ];then echo "$n" > /dev/null
           elif [ "$n" == "new" ];then echo "$n" > /dev/null
           elif [ "$n" == "tmp" ];then echo "$n" > /dev/null
           elif [ "$n" == "" ];then echo "$n" > /dev/null
           else
           echo  "$n"@"$i"
           fi
      done
    done
    echo;echo;
done

 

  • Like 1

Share this post


Link to post
Share on other sites

πρέπει να το δοκιμάσω το παρακάτω, δείχνει καλύτερο ίσως

cat /dev/null > /root/mailaccounts.txt
 
CP_ACCOUNTS=`ls -1A /var/cpanel/users/`
 
for user in `echo -n $CP_ACCOUNTS`
do
/root/mailaccounts.txt
domain=`grep -i ^dns /var/cpanel/users/$user |cut -d= -f2`
for dom in `echo -n "$domain"`
do
PASSWD_FILE="/home/$user/etc/$dom/passwd"
if [ -f $PASSWD_FILE ] && [ -s $PASSWD_FILE ]
then
for mail in `cat $PASSWD_FILE| cut -d":" -f1`
do
echo "$mail@$dom" >> mailaccounts.txt
done
fi
done
done

https://www.nixpal.com/cpanel-count-and-list-all-mailboxes/

  • Like 1

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×