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