Powered by Blogger.

Zimbra Tips : How To Set COS (Class Of Service) for All Users

Few days ago, i am migrating Zimbra mail server from OSE version to NE version. The migrating process working fine from migrating Account, Password, Alias Account, Distribution List, Mailboxes and etc. All account after migration still using default value on new Zimbra NE. My client want the new Zimbra NE using value/parameter like Class Of Services on old Zimbra. Create the COS on new Zimbra with the same name/value/features like COS on old Zimbra. After created, the new COS applied to all account with the following command.
1.zmprov sac accountname cosname
example
1.zmprov sac admin@example.com staff
Note :
The above command will modify COS for admin@example.com account with COS name staff. If you want to set COS for all account, you can make a script as below
1.vi /srv/set-cos.sh
Fill with the following line
01.#!/bin/bash
02. 
03.clear
04.rm /srv/modify-cos.zmp
05.echo "Retrieve zimbra user name..."
06. 
07.USERS=`su - zimbra -c 'zmprov -l gaa | sort'`;
08. 
09.for ACCOUNT in $USERS; do
10.echo "Modify COS for account $ACCOUNT"
11.echo "sac $ACCOUNT staff" >> /srv/modify-cos.zmp
12.done
Give execute access and run the above script
1.chmod +x /srv/set-cos.sh
2.sh /srv/set-cos.sh
The result of the above script is file with name modify-cos.zmp which is located in /srv/ folder. Execute it file with the following command as user Zimbra
1.su - zimbra
2.zmprov < /srv/modify-cos.zmp
Good luck and hopefully useful 😀
    Blogger Comment
    Facebook Comment