Zimbra offers Open Source email server software and shared calendar for Linux and the Mac
Go Back   Zimbra :: Forums > Zimbra Collaboration Suite > Administrators

Welcome to the Zimbra :: Forums!
Welcome, if you would like to post a comment please register. We also encourage you to explore all things Zimbra with our team and members of the community.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-01-2006, 09:33 AM
Senior Member
 
Posts: 72
Question Bulk Remove domain aliases

I have a domain expiring and have a large number of users with it setup as an alias. Zimbra won't let me remove the domain without removing each alias pointing to it first, is there a way to automate this process? I really don'twant to have to sort through all of my users to determine which ones have this set up as an alias... Is there any reason I can't search on the domain and get a list of emails/aliases for that particular domain? I'm working on a script for it now, but i'm not sure how well it will work out. If there's an easier/quicker way feel free to let me know.

Thanks,
Kyle
Reply With Quote
  #2 (permalink)  
Old 09-01-2006, 10:10 AM
Senior Member
 
Posts: 72
Default

Think I've found a solution, I'll post the code once i've confirmed it's working properly.

Thanks,
Kyle
Reply With Quote
  #3 (permalink)  
Old 09-01-2006, 10:36 AM
Zimbra Consultant & Moderator
 
Posts: 19,653
Default

Quote:
Originally Posted by kechols
Think I've found a solution, I'll post the code once i've confirmed it's working properly.
If it works could you enter it in the wiki for future users?
__________________
Regards


Bill
Reply With Quote
  #4 (permalink)  
Old 09-01-2006, 10:43 AM
Senior Member
 
Posts: 72
Talking

No problem.
Reply With Quote
  #5 (permalink)  
Old 09-01-2006, 02:45 PM
Senior Member
 
Posts: 72
Wink I got it working somewhat......

It got all but 2 aliased accounts for me. I can post it here for you for now, and once i've refined it a little (probably over the weekend or next week) post a nice "I know this'll work version". The only problem I have with it is you HAVE to run this code as eith root or zimbra either way it will sudo -u zimbra for parts that require zimbra user do the work. It's ugly, but works.

I've also discovered " zmprov sa mail=*@domain.tld " to get a full list of accounts. Up until now I've been connecting to and querying the mysql database directly. Since this would be used in production I think just querying the ldap would be quicker. It took me about 5 hrs to run through my 1900 accounts (as of this afternoon) and almost doubled the load on my server.
zimbra@mailserv6:~> zmprov sa mail=*@mydomain.com |wc -l
1907

Keeping all of this in mind (and the fact that it did miss 2 or 3 accounts on my server.) If you still want this release posted on the wiki I'll get right on it.
If you want a nice (hopefully more processor friendly) release give me the this weekend and some of next week and I'll see what I can do to improve on it.


Thanks,
Kyle

Last edited by kechols; 09-01-2006 at 03:32 PM..
Reply With Quote
  #6 (permalink)  
Old 09-01-2006, 03:21 PM
Zimbra Employee
 
Posts: 2,103
Default zmmailbox command in 4.0

totally off topic - but there's a partner command to zmprov in 4.0, zmmailbox. zmmailbox help commands for usage, but it's a CLI interface to manipulate mailboxes, should be handy to use.
__________________
Bugzilla - Wiki - Downloads - Before posting... Search!
Reply With Quote
  #7 (permalink)  
Old 09-01-2006, 03:30 PM
Senior Member
 
Posts: 72
Default

I'm still on 3.1 unfortunately, though hopefully 4.0 will provide enough of an incentive to my bosses to let me upgrade it. We had a bad experience on the first upgrade attempt so I understand their lack of enthusiasm at the thought of another (unnecessary) attempt.
Reply With Quote
  #8 (permalink)  
Old 09-05-2006, 09:39 AM
Senior Member
 
Posts: 72
Lightbulb

Here is a script I created to delete aliased email accounts for you when deleting an aliased domain.

It searches the mySQL database for email accounts, then queries the LDAP using zmprov to delete these aliased emails for you. It's slow (4 or 5 hrs for 1800+ users to be checked/deleted) but far faster than doing it by hand. and it only left two accounts for me to have to delete myself. If you find this happens to you, you can run " zmprov sa mail=*@domain.tld " to get a list of aliased accounts stilll on the server. I'll be working on a new script for this soon that implements this option instead of going through the database and pulling accounts. This should clear up some errors regarding non-existant accounts that may be thrown through the deletion process.

I'm still working on getting this posted to the wiki but it doesn't like non image files being uploaded and seems to destroy formatting when i copy and paste.
Attached Files
File Type: txt zmdelaliasdomain.php.txt (4.9 KB, 300 views)
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads

Why Join?

Registering let's you ask questions, makes it easier to search, displays any files attached to posts, and notifies you about replies.

blog.zimbra.com




 

SEO by vBSEO ©2011, Crawlability, Inc.