Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: Bulk Provisioning script help

  1. #1
    rev.derek is offline Active Member
    Join Date
    Aug 2009
    Location
    New Zealand
    Posts
    32
    Rep Power
    5

    Default Bulk Provisioning script help

    Hi,

    I am trying to add multiple users by using the bulk provisioning facility. I create the csv in the form
    id,name,passwd
    id2,name2,passwd2
    ...
    id99,name99,passwd99<EOF>

    When I run the script it tells me their is a number of fields error on the last line (or lines if I have blank lines, too).
    If I delete the last line, then the error moves back a line. It barfs in unix and dos format and barfs if I add a final comma before the <EOF>
    ??

  2. #2
    phoenix is online now Zimbra Consultant & Moderator
    Join Date
    Sep 2005
    Location
    Vannes, France
    Posts
    23,491
    Rep Power
    56

    Default

    You haven't really given any information that would allow anyone to answer your question. What is the script you're using? What is the format of the input file you're using? There are several threads in the forums that have details of bulk provisioning scripts, have you searched the forums and checked them?
    Regards


    Bill


    Acompli: A new adventure for Co-Founder KevinH.

  3. #3
    rev.derek is offline Active Member
    Join Date
    Aug 2009
    Location
    New Zealand
    Posts
    32
    Rep Power
    5

    Default Bulk Provisioning

    I'm not sure what additional detail will help.

    The format of the file is as shown here (I'm using real names in the real file etc.)

    name@organisation.org.nz,display name,password<NL>
    name2@organisation.org.nz,display name2,password2<NL>
    ... etc to my last user ...
    name11@organisation.org.nz, display name11,password11<EOF>


    I have tried recoding from unix to dos with no effect.

    Then I'm inputting this file from the Bulk Provision option in the Zimbra Admin Accounts page and after the last full line and any following empty lines are returning an error:-
    Linexxarse error:Invalid number of columns.
    It is ONLY the last full line and any trailing empty lines that raise the error.

    If I introduce a space after the comma (as suggested by the bulk-provision window) then the spaces would seem to be included as part of the data judging by the window display and, in any event, the error recurs.


    I had searched the forums but not found any help - of course I may have missed something.

    Although I have only 11 users to add, it seems to be an issue that needs resolving.

    Is there more I can add, because this information was pretty much in the original post, I thought?

    Thanks.

  4. #4
    dalmate is offline Elite Member
    Join Date
    Jan 2009
    Posts
    364
    Rep Power
    6

    Default

    I think maybe you enter some error lines. Zimbra alway shows which line is error so you should fix them before run script.( maybe you delete them )

  5. #5
    rev.derek is offline Active Member
    Join Date
    Aug 2009
    Location
    New Zealand
    Posts
    32
    Rep Power
    5

    Default

    Agreed - so if I delete the last line, the previous line (which has become the new last line) shows an error. It must be something to do with the way the last line is terminated. What does Zimbra expect? <EOF>, <NL><EOF>, <NL><CR><EOF>? Tried them all and all give an error, in fact with any combination of <NL> I get two errors - the last alpha line and the single empty final line. There is nothing unusual in the existing last line, no non-alpha characters except the commas. I've rewritten the file and changed it around and all sorts - it is always the last alpha line that has the error.
    :-/

  6. #6
    dalmate is offline Elite Member
    Join Date
    Jan 2009
    Posts
    364
    Rep Power
    6

    Default

    You can use excel to create a file with 3 cols and fill in 3 col. Then you save that file in csv format. Last you can check it by notepad or notepad++, you'll see its format

  7. #7
    fviero is offline Project Contributor
    Join Date
    Jun 2007
    Location
    Porto Alegre, RS, Brazil
    Posts
    96
    Rep Power
    8

    Default

    I use this procedure for bulk user creation:

    1. Create a csv containing these fields:
    email,password,first_name,last_name

    2. Use this script to create a zmprov readable output:
    Bulk Provisioning - Zimbra :: Wiki

    3. Run this script with your csv as argument and direct the output to a file. Then, copy the generated file to, say, /opt/zimbra (for simplicity).

    4. su - zimbra and then run zmprov < output_filename

    5. Watch the magic happen

  8. #8
    borngunners is offline Advanced Member
    Join Date
    Jun 2009
    Posts
    195
    Rep Power
    6

    Default

    Quote Originally Posted by fviero View Post
    I use this procedure for bulk user creation:

    1. Create a csv containing these fields:
    email,password,first_name,last_name

    2. Use this script to create a zmprov readable output:
    Bulk Provisioning - Zimbra :: Wiki

    3. Run this script with your csv as argument and direct the output to a file. Then, copy the generated file to, say, /opt/zimbra (for simplicity).

    4. su - zimbra and then run zmprov < output_filename

    5. Watch the magic happen
    Which one of the scripts in step 2 should I use if I am to import all ldap users to zimbra? also, the csv that I will be creating where do I have to place that file?

    Thanks

  9. #9
    fviero is offline Project Contributor
    Join Date
    Jun 2007
    Location
    Porto Alegre, RS, Brazil
    Posts
    96
    Rep Power
    8

    Default

    Quote Originally Posted by borngunners View Post
    Which one of the scripts in step 2 should I use if I am to import all ldap users to zimbra? also, the csv that I will be creating where do I have to place that file?

    Thanks
    You use the script that starts like this:

    #!/usr/bin/perl

    # Lookup the valid COS (Class of Service) ID in the interface or like this
    my $cosid = `su - zimbra -c 'zmprov gc Default |grep zimbraId:'`;
    $cosid =~ s/zimbraId:\s*|\s*$//g;

    The one immediately below the section title "CSV file to zmprov"

    You need to dump from your ldap in the format i mentioned above. This dump will be your CSV. Place it wherever you like.

    Now, you should have 2 files:
    1. The script (let's call it create_zimbra_zmprov.sh)
    2. The csv (let's call it userlist.csv)

    Then, you'll do:
    ./create_zimbra_zmprov.sh userlist.csv > zmprov_commands.out

    This will generate a file called zmprov_commands.out in the same dir where you run the script.

    Copy this file, zmprov_commands.out, to /opt/zimbra
    chown it to zimbra:zimbra (chown zimbra:zimbra /opt/zimbra/zmprov_commands.out)

    Now, su - zimbra
    and now, zmprov < zmprov_commands.out

    and let there be light

  10. #10
    borngunners is offline Advanced Member
    Join Date
    Jun 2009
    Posts
    195
    Rep Power
    6

    Default

    I have an error after following your instructions. I just want the username from my remote ldap instead of the entire email. Below is the error message:
    zimbra@test:~$ zmprov < zmprov_commands.out
    prov> ERROR: service.INVALID_REQUEST (invalid request: must be valid email addre ss: email@)
    prov> ERROR: service.INVALID_REQUEST (invalid request: must be valid email addre ss: email@)
    prov> ERROR: service.INVALID_REQUEST (invalid request: must be valid email addre ss: email@)
    prov> ERROR: service.INVALID_REQUEST (invalid request: must be valid email addre ss: email@)
    prov> ERROR: service.INVALID_REQUEST (invalid request: must be valid email addre ss: email@)
    prov> ERROR: service.INVALID_REQUEST (invalid request: must be valid email addre ss: email@)
    prov> ERROR: service.INVALID_REQUEST (invalid request: must be valid email addre ss: email@)
    prov> prov> zimbra@test:~$


    In this case, there was no light :-) it was darknest. Please help
    Last edited by borngunners; 08-31-2009 at 06:08 PM.

Page 1 of 2 12 LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 2
    Last Post: 04-20-2009, 06:23 PM
  2. zimbra opesource Backup Script Problem!
    By tashi in forum Administrators
    Replies: 4
    Last Post: 03-30-2009, 11:49 PM
  3. Bulk provisioning zimlet
    By sn00p in forum Administrators
    Replies: 1
    Last Post: 12-02-2008, 09:48 PM
  4. Zimbra Open Source Backup Help
    By ayush1440 in forum Administrators
    Replies: 8
    Last Post: 11-13-2008, 04:56 AM
  5. Bulk Provisioning
    By scalper in forum Administrators
    Replies: 4
    Last Post: 05-16-2007, 01:42 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •