Re: пропали аккаунты

От: Farit <CGatePro_at_mx_ru>
Дата: Tue 24 Jun 2003 - 15:17:43 MSD


Не повезло тебе, мужик.
Это известная проблема. Если вдруг сервер зависнет, то 100% попортятся account.info в тех ящиках, куда в момент зависания шли письма. А тут ещё хуже.

Первым делом надо выбрать домен, в нем Domain Settings->Directory Integration
Delete All - Insert All

Потом может пригодиться метод грубой силы, примерный скриптик:

#!/usr/bin/perl

use CLI;
use File::Copy;

my %acc;

my $CGPRO_ACCOUNTS_DIR = "/var/CommuniGate/Accounts"; my $Domain = "test.ru";

# check now the dirs with accounts

     opendir(DIR, $CGPRO_ACCOUNTS_DIR) or next;
     while (defined (my $account_dir = readdir(DIR))) {
	my $account;
         if ($account_dir =~ /(.*)\.macnt/) {
	    $account = $1;
	    $acc{$account} = 0;
         }
     }


#print "Domain: ";         # Print the domain prompt
#my $Domain = <STDIN>;     # Read the domain name from standard input
#chomp $Domain;            # Remove \n if present



# You may need to redefine the following variable if you're connecting
not to
# the main domain. IP address is OK.

$CGServerAddress = $Domain;

print "Login (Enter for \"postmaster\@$Domain\"): "; my $Login = <STDIN>;
chomp $Login;
if ($Login eq '') { $Login = "postmaster\@$Domain"; } #my $Login = "postmaster\@$Domain";

print "Password: ";
my $Password = <STDIN>;
chomp $Password;

# Open TCP connection to given address port 106 (PWD, or CGPro CLI).
# Submit username and password. If login fail, the program will stop.
my $cli = new CGP::CLI( { PeerAddr => $CGServerAddress,

                           PeerPort => 106,
                           login    => $Login,
                           password => $Password } )
    || die "Can't login to CGPro: ".$CGP::ERR_STRING."\n";

my $Accounts=$cli->ListAccounts($Domain)

                    || die "Error: ".$cli->getErrMessage.", quitting";
foreach my $UserName (keys %$Accounts) {
     $acc{$UserName} = 1;

}

foreach my $UserName (sort keys %acc) {

     if ($acc{$UserName} == 0) {
	print "$UserName\n";
	my $UserDir = "$UserName" . ".macnt";
	system("mv -f $CGPRO_ACCOUNTS_DIR/$UserDir /tmp/$Userdir");	
	$cli->CreateAccount(accountName => $UserName)
	    || die "Error: ". $cli->getErrMessage ." \n";
	my($from, $to);
	
	$from = "/tmp/$UserDir/account.settings";
	$to = "$CGPRO_ACCOUNTS_DIR/$UserDir/account.settings";
	copy($from, $to);

	$from = "/tmp/$UserDir/INBOX.mbox";
	$to = "$CGPRO_ACCOUNTS_DIR/$UserDir/INBOX.mbox";		
	copy($from, $to);	
		
     }	

}

$cli->Logout; Получено Tue Jun 24 11:04:59 2003

Этот архив был сгенерирован hypermail 2.1.8 : Tue 21 Feb 2006 - 03:14:24 MSK