Results 1 to 3 of 3

Thread: Fast way to get all accounts and aliases?

  1. #1
    simonb is offline Trained Alumni
    Join Date
    Sep 2005
    Rep Power

    Default Fast way to get all accounts and aliases?

    I need a list of all accounts and aliases for a script I am writing. I have a one-liner that looks like it will deliver the goods but it is incredibly slow (one hour and counting)...
    for i in `zmprov -l gaa`; do echo "$i"; zmprov -l ga $i | grep -i "MailAlias" | sed 's/zimbraMailAlias\: //gi'; done | sort | uniq
    When I use the admin web interface I can see lists of accounts and aliases almost instantly. So how does the admin interface do it? I would like to get these lists from the command line at a similar speed. Is this possible?

  2. #2
    jummo is offline Special Member
    Join Date
    May 2009
    Bremen, Germany
    Rep Power


    Quick'n'Dirty and not a one-liner.

    rm $tempfile1 $tempfile2 $tempfile3 2> /dev/null
    for i in $(zmprov -l gaa); do 
      echo "ga $i zimbraMailAlias" >> $tempfile1
    zmprov < $tempfile1 > $tempfile2
    awk '{ print $2 }' $tempfile1 > $tempfile3 
    egrep -v '^prov>|^$' $tempfile2 | awk '{ print $2 }' >> $tempfile3
    sort -u $tempfile3
    rm $tempfile1 $tempfile2 $tempfile3
    Need 16 secondes for over 400 accounts. Instead of run zmprov for each account to get the zimbraMailAlias zmprov use the $tempfile1 for command input. Therefore zmprov is only run twice.

  3. #3
    simonb is offline Trained Alumni
    Join Date
    Sep 2005
    Rep Power


    Thanks for the speedy and detailed response! I'll give that a try.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Error on renaming and creating aliases accounts
    By cbatista in forum Administrators
    Replies: 6
    Last Post: 01-21-2010, 04:17 AM
  2. Resource Accounts as Personas?
    By RWilliams in forum Users
    Replies: 0
    Last Post: 06-29-2009, 10:01 AM
  3. How to list accounts with their associated aliases?
    By skerns in forum Administrators
    Replies: 2
    Last Post: 03-10-2009, 02:10 PM
  4. Multiple aliases on different accounts
    By flums in forum Administrators
    Replies: 5
    Last Post: 12-14-2007, 12:35 PM
  5. Replies: 0
    Last Post: 08-23-2007, 09:06 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts