>We've just added an extra drive/partition to our cyrus server...i've
>added the partition into /etc/imapd.conf and can successfully use cyradm
>to move single folders across to the new drive...very easy!
>
>however, cyradm sees to only move SINGLE folders at a time...
>
>
>ie
>
>> renm user.darrellb user.darrellb imap-sdb1
>
>will only move the 'inbox'...all the folders under user.darrellb stay on
>the orginal partition...and what i want is is to be able to move users
>wholesale, one-by-one, to the new partition, taking all their subfolders
>with them...
>
>has anyone any tips/scripts or ideas about how to automate this process?
>
>TIA
>
>- darrell
here's a TCL script to do it:
#### cyrus_moveuser.tcl lmr 9/11/2000 based on Cyrus IMAP cyrinit.tcl
#### Larry M. Rosenbaum, Oak Ridge National Laboratory ([EMAIL PROTECTED])
# default value for new partition name
eval set default_part "imap3"
eval cyradm connect cyr_conn "localhost"
# Authenticate, prompting for userid and password as necessary
eval cyr_conn authenticate -pwcommand {{
set hostname %h
if {[string length %u] == 0} {
puts -nonewline "$hostname userid: "
flush stdout
gets stdin userid
} else {set userid %u}
exec stty -echo >@stdout
puts -nonewline "$hostname password: "
flush stdout
#stty -echo
gets stdin passwd
#stty echo
exec stty echo >@stdout
puts ""
list $userid $passwd
} }
# loop to move users
eval {
while {1} {
puts -nonewline "User to move: "
flush stdout
gets stdin username
# exit on empty username
if {[string length $username] == 0} {
puts "Goodbye"
exit
}
puts -nonewline "New partition \[$default_part\]: "
flush stdout
gets stdin newpart
if {[string length $newpart] == 0} {
set newpart $default_part
}
# check for user's INBOX
set mytop [cyr_conn listmailbox "user.$username"]
if {[llength $mytop] == 0} {
puts "No mailboxes for user $username"
unset mytop
continue
}
puts "Moving $username"
# get the rest of the user's mailbox tree
set mylist [cyr_conn listmailbox "user.$username.*"]
# add the INBOX to the list
lappend mylist "user.$username"
# move each mailbox
foreach boxinfo $mylist {
set box [lindex $boxinfo 0]
#puts "Rename $box $box $newpart"
if [catch {cyr_conn renamemailbox $box $box $newpart} errmsg] {
puts "$box $errmsg"
} else {
puts "$box moved OK"
}
}
}
}
--
========================
Larry M. Rosenbaum [EMAIL PROTECTED]
Bldg 4500-N, Room E-218 865 574-8155 phone
PO Box 2008, MS 6271 865 241-4000 fax
Oak Ridge, TN 37831-6271
Oak Ridge National Laboratory, Network Computing Services group