Has anyone created a shell script similar to what is described below?
Scenario: An automated windows script creates a comma-delimited list of current users in Active Directory and places it on the Samba share of an Ubuntu / Zimbra server on a daily basis. A cron job runs every hour looking for the file in the samba share.
Pseudo code for the Ubuntu script:
Code:
If /srv/samba/share/adlist.csv Exists
{
Move /srv/samba/share/adlist.csv To /temp/adlist.csv
While Not End of File (/temp/adlist.csv)
{
If Not Exist File.UserID in Zimbra
{
Create Zimbra Mailbox (File.UserID, File.FirstName, File.LastName, File.Password, DistributionList.Everyone)
If successful mailbox creation
{
Write "Creation of UserID success!" To LogFile
}
Else if not successful mailbox creation
{
Write "Creation of UserID failed due to error such-n-so" To LogFile
}
}
Read Next Line
}
Delete /temp/adlist.csv
If LogFile Exists
{
Email LogFile to Administrators
}
} Sample adlist.csv
Code:
UserID, FirstName, LastName, Password
JDoe, John, Doe, abc123
MJane, Mary, Jane, xyz321
ArnoldS, Arnold, Swartzensomething, gun4u
I have found the
zmprov command-line documentation to "getAccount" and "createAccount" but I'm not well-versed in unix scripting and file manipulation. Any pointers, examples and whatnot would be appreciated.
EDIT: In case anyone wants to know, I did get AD Authentication and AD GAL working but it just works better if everything is controlled on the Zimbra side. Therefore, I'm avoiding the direct AD integration and opt'ing for a semi-automated sync.
Thanks,
LHammonds