Différences
Ci-dessous, les différences entre deux révisions de la page.
Les deux révisions précédentes Révision précédente Prochaine révision | Révision précédente Prochaine révision Les deux révisions suivantes | ||
tuto:ipasserelle:divers:scripts_dokuwiki [27/11/2013 12:41] heuzef |
tuto:ipasserelle:divers:scripts_dokuwiki [16/01/2019 09:42] dani |
||
---|---|---|---|
Ligne 3: | Ligne 3: | ||
Voilà quelques scripts qui permettent de générer des tableaux au format dokuwiki: | Voilà quelques scripts qui permettent de générer des tableaux au format dokuwiki: | ||
- | * Génère un tableau de tous les dossiers partagés (uniquement via la contrib | + | |
+ | |||
+ | <file perl users.pl> | ||
+ | # | ||
+ | |||
+ | use strict; | ||
+ | use esmith:: | ||
+ | use esmith:: | ||
+ | |||
+ | my $a = esmith:: | ||
+ | my $c = esmith:: | ||
+ | |||
+ | my $main_dom = $c-> | ||
+ | |||
+ | my @fws_accounts = qw( | ||
+ | fws | ||
+ | maillog | ||
+ | backup | ||
+ | mails-partages | ||
+ | scanner | ||
+ | deploiement | ||
+ | auth | ||
+ | ); | ||
+ | |||
+ | print '^ Identifiant ^ Nom ^ Prénom ^ Adresse email principale ^' . " | ||
+ | |||
+ | foreach ($a-> | ||
+ | my $name = $_-> | ||
+ | if (grep { $name eq $_ } @fws_accounts){ | ||
+ | $name = '< | ||
+ | } elsif (($_-> | ||
+ | $name = '< | ||
+ | } | ||
+ | print ' | ||
+ | ' | ||
+ | " | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | | ||
<file perl shares.pl> | <file perl shares.pl> | ||
# | # | ||
Ligne 25: | Ligne 64: | ||
} | } | ||
elsif ($remote eq ' | elsif ($remote eq ' | ||
- | $rem = ' | + | $rem = ' |
} | } | ||
elsif ($remote eq ' | elsif ($remote eq ' | ||
- | $rem = ' | + | $rem = ' |
} | } | ||
elsif ($remote eq ' | elsif ($remote eq ' | ||
- | $rem = ' | + | $rem = ' |
} | } | ||
elsif ($remote eq ' | elsif ($remote eq ' | ||
- | $rem = ' | + | $rem = ' |
} | } | ||
elsif ($remote eq ' | elsif ($remote eq ' | ||
Ligne 41: | Ligne 80: | ||
my $com = ''; | my $com = ''; | ||
if ($name eq ' | if ($name eq ' | ||
- | $com = " | + | $com = " |
} | } | ||
elsif ($name eq ' | elsif ($name eq ' | ||
- | $com = " | + | $com = " |
} | } | ||
elsif ($name eq ' | elsif ($name eq ' | ||
- | $com = " | + | $com = " |
} | } | ||
elsif ($name eq ' | elsif ($name eq ' | ||
- | $com = " | + | $com = " |
} | } | ||
print ' | print ' | ||
+ | } | ||
+ | foreach my $ibay ($a-> | ||
+ | my $name = $ibay-> | ||
+ | my $access = $ibay-> | ||
+ | my $remote = $ibay-> | ||
+ | my $group = $ibay-> | ||
+ | my $com = $ibay-> | ||
+ | my $w = ''; | ||
+ | my $r = ''; | ||
+ | my $rem = ''; | ||
+ | if ($access eq ' | ||
+ | $w = $group; | ||
+ | } | ||
+ | elsif ($access eq ' | ||
+ | $w = $group; | ||
+ | $r = 'Tous les utilisateurs'; | ||
+ | } | ||
+ | elsif ($access eq ' | ||
+ | $w = ' | ||
+ | $w = $group; | ||
+ | } | ||
+ | if ($remote eq ' | ||
+ | $rem = ' | ||
+ | } | ||
+ | elsif ($remote eq ' | ||
+ | $rem = ' | ||
+ | } | ||
+ | elsif ($remote eq ' | ||
+ | $rem = ' | ||
+ | } | ||
+ | elsif ($remote eq ' | ||
+ | $rem = ' | ||
+ | } | ||
+ | elsif ($remote eq ' | ||
+ | $rem = ' | ||
+ | } | ||
+ | elsif ($remote eq ' | ||
+ | $rem = ' | ||
+ | } | ||
+ | print ' | ||
} | } | ||
</ | </ | ||
Ligne 96: | Ligne 175: | ||
print ' | print ' | ||
+ | </ | ||
+ | |||
+ | * Génère un tableau avec les groupes (et leur pseudo pointant dessus) et la liste des utilisateurs qui recevront les mails | ||
+ | <file perl grpmail.pl> | ||
+ | # | ||
+ | |||
+ | use esmith:: | ||
+ | use esmith:: | ||
+ | |||
+ | my $a = esmith:: | ||
+ | my $c = esmith:: | ||
+ | my $domain = $c-> | ||
+ | |||
+ | print ' | ||
+ | |||
+ | foreach my $group ($a-> | ||
+ | my $name = $group-> | ||
+ | my $addr = $name . ' | ||
+ | foreach my $pseudo ($a-> | ||
+ | my $target = $pseudo-> | ||
+ | if ($target eq $name){ | ||
+ | my $p = $pseudo-> | ||
+ | $p .= ($pseudo-> | ||
+ | $addr .= '\\\\ ' . $p; | ||
+ | } | ||
+ | } | ||
+ | my @members = split ',', | ||
+ | my $str = ' | ||
+ | foreach my $member (@members){ | ||
+ | $member .= ($member =~ m/\@/) ? '' | ||
+ | $str .= $member . ', '; | ||
+ | } | ||
+ | $str =~ s/, $//; | ||
+ | $str .= ' |' . " | ||
+ | print $str; | ||
+ | } | ||
</ | </ |