Zimbra offers Open Source email server software and shared calendar for Linux and the Mac
Go Back   Zimbra :: Forums > Zimbra Collaboration Suite > Administrators

Welcome to the Zimbra :: Forums!
Welcome, if you would like to post a comment please register. We also encourage you to explore all things Zimbra with our team and members of the community.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-08-2010, 04:00 AM
Loyal Member
 
Posts: 80
Default Sharing my Bulk Import script...

Hi Guys.
Here follows my script to do a BULK IMPORT. I share it to give something back. Following the script I will add the output of the userdata file:

<script Start>
> output
while read line
do
STRINGS=`echo "$line"`
user=`echo $STRINGS|awk '{print $1}'`
password=Password12
displayName=`echo $STRINGS|awk '{print $2" "$3}'`
surname=`echo $STRINGS|awk '{print $3}'`
givenName=`echo $STRINGS|awk '{print $2}'`
displayName=`echo $STRINGS|awk '{print $2" "$3}'`
mobile=`echo $STRINGS|awk '{print $4}'`
address=`echo $STRINGS|awk '{print $5}'`
telephone=`echo $STRINGS|awk '{print $6}'`
group=`echo $STRINGS|awk '{print $7}'`
alias=`echo $STRINGS|awk '{print $8}'`
descript=`echo $STRINGS|awk '{for (i=9; i<=NF; i++) printf "%s", $i;}'`
street=`cat $address`

echo "ca $user $password" >> output
echo "ma $user displayName \"$displayName\"" >> output
echo "ma $user description \"$descript\"" >> output
echo "ma $user cn \"$displayName\"" >> output
echo "ma $user sn \"$surname\"" >> output
echo "ma $user mobile \"$mobile\"" >> output
echo "ma $user telephoneNumber \"$telephone\"" >> output
echo "ma $user company \"Domain\"" >> output
echo "ma $user street \"$street\"" >> output
echo "ma $user givenName \"$givenName\"" >> output
echo "ma $user zimbraPasswordMustChange \"TRUE\"" >> output
echo "adlm $group $user " >> output
echo "aaa $user $alias" >> output

done < userdata
zmprov < output
<Script End>

userdata file:
1koos@domain.co.za Koos Petoors 083-212-2112 CT 021-910-8777 it@domain.co.za oldkoos@domain.co.za General Cleaner
<start>

The userfile has the following format:
<email> <name> <surname> <cell> <address> <tel> <list> <alias> <description...>

The description can be however long you want it.
The CELL can be replaced by a "-" (an error will display, but noting will be added)

CT (address) is a file in the following format:
<Building>\n<Street address>\n<city>\n<postal code>
i.e:
Guest House\n12 first st\nHanover\n1234
it will then display in the addressblock:
Guest House
12 first st
Hanover
1234

I have multiple files, named CT, DB, PF etc with the addressdetails inside, which then fills the correct details in for me.

Hope this can be of help to you
Kind regards
Aubrey Kloppers
Cape Town
South Africa
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads

Why Join?

Registering let's you ask questions, makes it easier to search, displays any files attached to posts, and notifies you about replies.

blog.zimbra.com




 

SEO by vBSEO ©2011, Crawlability, Inc.