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