Blob Blame History Raw
#!/usr/bin/perl
#
# Usage:	batchreconstruct inputfile
#
# Purpose:	Runs the Cyrus reconstruct command on each newly-created 
#		Cyrus mailbox created by folderxfer
#
# Input:	List of usernames, one per line
#
#$Id: batchreconstruct,v 1.1 2005/04/15 20:24:15 jdennis Exp $

#$whoami     = "/usr/ucb/whoami"; # Solaris
$whoami      = "/usr/bin/whoami";
$reconstruct = "/usr/lib/cyrus-imapd/reconstruct";
$cmd         = "$reconstruct -r";

chop ($iam = `$whoami`);
if ($iam ne "cyrus" ) { 
    die "You must be cyrus to run this script!\n"; 
}

$users   = "$ARGV[0]";
if (!$users) { die "Usage: $0 input_file\n"; }

open(MB,"$users") || die "can't open $users";

while (<MB>) {
    chop;
    system("$cmd user.$_");
}
close MB;