check_mbox_cyrus.pl
#!/usr/bin/perl
use Mysql;

$file = "cyrus_users.txt";
$server = 'localhost';
$sqluser = 'dbuser';
$sqlpass = 'secret';
$db = 'dbname';

$db = Mysql->connect($server, $db, $sqluser, $sqlpass);
open(USERS, $file) || die "No se pudo abrir $file\n";
@users = <USERS>;
foreach (@users) {
  chop;
  ($username,$domain) = split(/\@/);
  $sqlquery = "SELECT username,realm FROM authreg WHERE username='$username' AND realm='$domain'";
  $query = $db->query($sqlquery);
  @array = $query->fetchrow;
  $username = $username . "@" . $domain;
  if ($array[0]) {
    print $username, " OK\n";
  } else {
    print $username, " ERROR\n";
  }
}
There are no comments on this page.
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki