d0d307
#!/usr/bin/perl
d0d307
#
d0d307
# Usage:	batchreconstruct inputfile
d0d307
#
d0d307
# Purpose:	Runs the Cyrus reconstruct command on each newly-created 
d0d307
#		Cyrus mailbox created by folderxfer
d0d307
#
d0d307
# Input:	List of usernames, one per line
d0d307
#
d0d307
#$Id: batchreconstruct,v 1.1 2005/04/15 20:24:15 jdennis Exp $
d0d307
d0d307
#$whoami     = "/usr/ucb/whoami"; # Solaris
d0d307
$whoami      = "/usr/bin/whoami";
d0d307
$reconstruct = "/usr/lib/cyrus-imapd/reconstruct";
d0d307
$cmd         = "$reconstruct -r";
d0d307
d0d307
chop ($iam = `$whoami`);
d0d307
if ($iam ne "cyrus" ) { 
d0d307
    die "You must be cyrus to run this script!\n"; 
d0d307
}
d0d307
d0d307
$users   = "$ARGV[0]";
d0d307
if (!$users) { die "Usage: $0 input_file\n"; }
d0d307
d0d307
open(MB,"$users") || die "can't open $users";
d0d307
d0d307
while (<MB>) {
d0d307
    chop;
d0d307
    system("$cmd user.$_");
d0d307
}
d0d307
close MB;
d0d307