CSV files and scripting... Hi All,
Please forgive me if this has already been discussed and feel free to redirect me to an existing thread!
I absolutley LOVE Zimbra. I work for the Menlo Park City School District and am really pushing Zimbra for our district. We currently use a plain ol' OS X Server to do mail (and it's been having MAJOR problems this past week...IMAP database corruption to be the latest fiasco).
Anyway, I'm setting up Zimbra and our OS X mail server to run side by side via the nifty imapsync tool (and having Zimbra send all mail through the OS X server) until we're ready to officially switch over. However, I need help automating this process!
I have a CSV file of all our users formatted in this way:
"username","password","First Name","Last Name"
I want to set up a script that'll allow me to pull from this CSV file when creating all our user accounts, as well as when imapsync runs.
I've got the basic command down, but I just don't know what type of loop to put it in, or how to create an array that'll grab the information from my CSV file.
zmprov createAccount $username@mpcsd.org password displayName '$firstname $lastname' givenName $firstname sn $lastname
(no password needs to be passed to Zimbra as all authentication is done via Active Directory)
and...
imapsync --buffersize 8192000 --nosyncacls --subscribe --syncinternaldates --host1 mail.mpcsd.org --user1 $username@mpcsd.org --password1 $password --host2 zimbra.mpcsd.org --user2 $username@mpcsd.org --password2 $password --noauthmd5
I saw the Perl script in the Zimbra Wiki, but got a little confused. Any help would be greatly appreciated!
Thanks!
~ Anthony |