Huu Phan | Blog Linux operating system | Linux operating system -Blog Huu Phan | www.huuphan.com
huuphan.com. Powered by Blogger.

My blog about Open Source: Zimbra Mail Server,linux,bash script,centos,linux command...

How to zimbra auto create distribution lists

In this tutorial, How to zimbra auto create distribution list by bash script. I’m written bash script for create distribution list.
  • Step 1: To check distribution lists name exists or not!
  • Step 2: To create distribution lists from file.
  • Step 3: Running zimbra auto create distribution lists bash script from root account.
You may reading link as below:

zimbra auto create distribution lists

The syntax create distribution lists command line from root account
su - zimbra -c "zmprov cdl [email protected]"
To create distribution lists from file. For example, I’m created list_distribute.txt in /tmp folder as below:
How to zimbra auto create distribution lists

Zimbra auto create distribution lists full script. Bash script for distribution lists name as below:
[[email protected] opt]# cat zimbra_Distribute.sh
The content zimbra_Distribute.sh as below:
#!/bin/bash
# Author: Phan Van Huu
# My site: www.huuphan.com and www.devopsskills.info
#
List_DL=/tmp/list_distribute.txt
while read count
do
Check_DL=$(su - zimbra -c "zmprov gadl | grep $count")
if [ $? == 0 ]
then
# To check distribution lists name exists or not!
echo "$count Exists!"
else
# To create distribution list
su - zimbra -c "zmprov cdl $count"
fi
done < $List_DL
Running zimbra auto create distribution lists bash script from root account.
[[email protected] opt]# ./zimbra_Distribute.sh
The output as below:
zimbra auto create distribution lists

Conclusion

Thought the article, To help you auto create distribution list from bash script. If you any question then comment below. The next article, I’m create bash script for How to add member to a distribution list.

post new :

Huu Phan | Blog Linux operating system | Huu Phan ~ Zimbra Mail Server,linux,bash script,centos,linux command | www.huuphan.com

This Blog is protected by DMCA.com