Author Topic: Group add script, CSV  (Read 4638 times)

Tibor Balázs

  • Zen Apprentice
  • *
  • Posts: 30
  • Karma: +2/-0
    • View Profile
Group add script, CSV
« on: November 23, 2012, 09:16:26 pm »
Helló!

Lehet tömegesen csoportokat felvenni!  :D
Futtatáskor kicsit el van vele, de működni látszik!

A megoldás nem az én érdemem: http://hup.hu/node/119658

Code: [Select]
root@zentyal:~/bin# ./add_grup2.pl
Group created: _valami4_
Group created: _valami5_
Group created: _valami6_
root@zentyal:~/bin# cat add_grup2.pl
#!/usr/bin/perl

use strict;
use warnings;

use EBox;
use EBox::UsersAndGroups::Group;

EBox::init();

open (my $GROUPS, 'groups');

while (my $line = <$GROUPS>) {
  chomp ($line);
  my ($group, $comment, $system) = split(',', $line);
  EBox::UsersAndGroups::Group->create($group, $comment, 0);
  print "Group created: $group\n";
}
close ($GROUPS);

1;
root@zentyal:~/bin# cat groups
_valami4_,comment4,0,
_valami5_,comment5,0,
_valami6_,comment6,0,
« Last Edit: November 23, 2012, 09:30:13 pm by Tibor Balázs »