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 02-22-2011, 03:52 AM
Intermediate Member
 
Posts: 23
Default script to block hotmail for all users

Dear all

I have single installation server of ZCO 6.8
I want to block gmail,yahoo,hotmail for 100 users ,and open the gmail,yahoo,hotmail for 10 users.

I know I should use this command
zmprov ma user1@avit.com.eg +amavisBlacklistSender "gmail.com"

I need to execute this command over 100 users ,it will be headache if I typed it 100 times so I know that I can get all the account from this command zmaccts

zmaccts

admin@avitdc.local active 12/22/10 09:40 02/20/11 15:45
ham.pludpzud@avitdc.local active 12/22/10 09:41 never
nagwan_sowelam@avitdc.local active 01/05/11 09:19 01/17/11 23:33
rina@avitdc.local active 12/22/10 13:24 02/20/11 15:47
spam.xtt_amrw1i@avitdc.local active 12/22/10 09:41 never
wiki@avitdc.local active 12/22/10 09:41 never

I want to make the argument of CMD zmprov ma to be variable and read from the output of zmaccts

Can anyone help me?
Reply With Quote
  #2 (permalink)  
Old 02-22-2011, 09:38 AM
Active Member
 
Posts: 48
Default

Use the "zmprov -l gaa" command to list all accounts and pipe it into a text file(account-list.txt). Remove the accounts you want from the text file. Then use a bash script with a simple for loop to make the changes.

#!/bin/sh
for i in $(cat account-list.txt); do
zmprov ma $i +amavisBlacklistSender "gmail.com"
sleep 5
done
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.