Koozali.org: home of the SME Server

abl-batch_users-0.5 - again!

jane

abl-batch_users-0.5 - again!
« on: April 11, 2003, 12:18:42 PM »
Hi,

I've try to make what I want by follow your instruction (Abe Loveless) but failed. Kindly I need your assistance again to give more details as I'm not clear in your words

"In line 42, you'll need to add the new variables in the system call that calls the "adduser" script. The format of the line should look like this:
acctName, Passwd, firstName, lastName, department, company, street, city, phone"

Actually I want to add user with the following format.

USERNAME:PASS:FIRSTNAME:LASTNAME:GROUP:DEPARTMENT:COMPANY:STREETADDR:CITY:PHONENO

Thanks again.

Abe Loveless

Re: abl-batch_users-0.5 - again!
« Reply #1 on: April 11, 2003, 07:16:48 PM »
Right.... that's the format of your file, which is fine.

The difference is that the file script.pl actually calls another script to create the user... then when control returns to the original script it adds the username to the group.

So, what I meant to say above is that on line 42, you have to edit the variables so that it sends the correct fields to the "adduser" script so the user can be created.

Here's an example:

Line 42:  system("echo $input_split[0]:$input_split[1]:$input_split[2]:$input_split[3] | $ARGV[0]");

Where $input_split[NUM] are the following values:
  • = username
  • [1] = password
    [2] = firstname
    [3] = lastname

    Your modifed line 42 should look pretty close to this:
    system("echo $input_split[0]:$input_split[1]:$input_split[2]:$input_split[3]:$input_split[5]:$input_split[6]:$input_split[7]:$input_split[8]:$input_split[9] | $ARGV[0]");

    Where $input_split
[NUM] are the following values:
  • = username
  • [1] = password
    [2] = firstname
    [3] = lastname
    [4] = group
    [5] = department
    [6] = company
    [7] = street
    [8] = city
    [9] = phone

    You'll notice in the modified line 42, that we left out $input_split[4] (GROUP).  It isn't needed to create the username, so we leave it out here.

    Let me know if you still have questions.

jane

Re: abl-batch_users-0.5 - again!
« Reply #2 on: April 12, 2003, 11:03:15 PM »
Hi,

I have modify the script.pl by follow your instruction. I just make $input_split[5] for the first testing. I modify also file adduser and change performCreateUser($1, $2, $3, $4, $5, "", "", "", "") at line 92.

Do I have finish the modification? And I got this error.

Use of uninitialized value in pattern match (m//) at ./adduser line 177, DIN> line 1.

Your advice again are really much appreciated. Thanks.

jane

Re: abl-batch_users-0.5 - again!
« Reply #3 on: April 14, 2003, 09:37:26 AM »
Now everythings was fine. I forgot to add as below at line 53

system("echo $input_split[0] ......:$input_split[5] | $ARGV[0]");

Thank you very much!!!

Alejandro Lengua

Re: abl-batch_users-0.5 - again!
« Reply #4 on: May 14, 2003, 05:36:04 PM »
Where can I get a script to add users by batch (that works in SME 5.6)?

Abe Loveless