Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
TetraWiki
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Zimbra Archive Server
(section)
Page
Discussion
English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Special pages
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==Script== The following script to add users automatically on the archive server, and also to the 'archivelist' file. Run this on the main server, and all users will be automatically added. You can place it in the crontab for every half an hour, so that when a new user is created on the main server, he/she will be automatically added to the archive server. SSH using keys (password-less ssh) between the main and archive server is necessary for the script to function. #!/bin/bash # ENSURE ALL THE SERVERS HAVE PASSWORDLESS SSH AUTHENTICATON (Login using keys), # OR THE SCRIPT WILL FAIL # ----------------------------------------------------------------------------- # Zimbra Archiving # # This script will add users that are present on the main Zimbra server, but not # on the archival server. It will also make the appropriate changes in postfix. # ------------------------------------------------------------------------------ # IP of the archive server (archive.example.com) ARCHIP=172.16.1.17 # File names of example.com and archive.example.com users # MAINLST is the userlist from the main server (example.com) # ARLST is the userlist from the archive server (archive.example.com) MAINLST=mainserverlist ARLST=archiveuserlist # Emptying out the input file for zmprov echo "" > /tmp/zmprovarchiv # Getting userlist from the archive server ssh $ARCHIP 'su -c "zmprov -l gaa | cut -d\@ -f1 > /tmp/archiveuserlist" -l zimbra' rsync -Pa $ARCHIP:/tmp/archiveuserlist /tmp/$ARLIST # Getting userlist from local (main) server su -c "zmprov -l gaa | cut -d\@ -f1 > /tmp/$MAINLST" -l zimbra # Sorting the files for comparison sort /tmp/$MAINLST > /tmp/sorted$MAINLST sort /tmp/$ARLST > /tmp/sorted$ARLST # Comparing the files, and getting the unique users of the example.com domain # This will get the new users created on example.com, but not present on the archive server comm -23 /tmp/sorted$MAINLST /tmp/sorted$ARLST > /tmp/newusers echo "Checking if there are new users" if [ -s /tmp/newusers ]; then # Loop to read users one by one for newuser in `cat /tmp/newusers`; do # Creating a file that will be the input for zmprov. # This will create the new user accounts on the archive server. # The user's passwords have been set to 'very_secure_PW_31812' echo "ca $newuser@archive.triburg.co.in very_secure_PW_31812" >> /tmp/zmprovarchiv done # Creates the file for postfix mapping. This file contains users in the form of 'from' and 'to' awk '{print $1"@triburg.co.in","\t",$1"@archive.triburg.co.in"}' /tmp/newusers >> /opt/zimbra/postfix/conf/archivelist # rsync the zmprov file to the archive server rsync -Pa /tmp/zmprovarchiv $ARCHIP:/tmp # Runs the zmprov command to add users on the archive server ssh $ARCHIP 'su -l zimbra -c zmprov < /tmp/zmprovarchiv' # Postmapping on the servers su -c "postmap /opt/zimbra/postfix/conf/archivelist" -l zimbra su -c "postfix reload" -l zimbra else exit fi Made By Abhinav Sharma
Summary:
Please note that all contributions to TetraWiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
TetraWiki:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)