[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[cobalt-users] Re: mass user add
- Subject: [cobalt-users] Re: mass user add
- From: Keith <keith@xxxxxxxxx>
- Date: Fri May 12 13:41:27 2000
Title: Re: mass user add
I am very interested in this script.
> ----------------------------------------------
> #!/usr/bin/perl
>
> # pass a comma separated list of
> #
> # username,fullname,password
> #
>
> use Getopt::Std;
> require Cobalt::User;
> use Cobalt::Meta;
>
> my $addfile = '/tmp/users.dat'; # the file which contains the users to be
> added
> my $group = "site1"; # Change the group to the one for Virtual Site you
> wanted
> my $quota = 5; # Disk quota in MB
> my $fpx = "off"; # Front Page Support
> my $apop = "off"; # Apop support
> my $admin = "off"; # User is admin or not
> my $shell = "off"; # allow shell access
> open IN, $addfile;
> flock (IN,2);
> @userdata = <IN>;
> close IN;
> foreach $usr (@userdata) {
> chomp($usr);
> ($username, $name, $passwd) = split(/\,/,$usr);
> print "creating $username.. ";
> my $m = Cobalt::Meta->new("type" => "users",
> "name" => "$username",
> "group" => "$group",
> "fullname" => "$name",
> "altname" => "",
> "password1" => "$passwd",
> "password2" => "$passwd",
> "quota" => "$quota",
> "fpx" => "$fpx",
> "apop" => "$apop",
> "shell" => "$shell",
> "admin" => "$admin",
> "suspend" => "",
> "aliases" => "",
> "forward" => "",
> "vacation" => "",
> "vacationmsg" => "");
> my $res = &Cobalt::User::site_user_add($m);
> if ($res) {
> print " ERROR: $res\n";
> } else {
> print "ok\n";
> }
> }
>
> =================================
How would I go about excuting.
Keith
----------------------
CyberSailing LLC
Suite #246
297-101 Kinderkamack Rd.
Oradell, NJ 07649
www.csail.com
keith@xxxxxxxxx
Fax: 201-802-0565
----------------------