Aus web-cyradm Mail:
you could do that with an expect-script:
#!/usr/bin/expect
set force_conservative 1 ;# set to 1 to force conservative mode even if ;# script wasn’t run conservatively originally if {$force_conservative} { set send_slow {1 .1} proc send {ignore arg} { sleep .1 exp_send -s – $arg } }
set username [lrange $argv 0 0]
set timeout 2
Start the program.
spawn /usr/bin/cyradm –user cyrus –server localhost match_max 100000
Look for the Password: line and send the password.
expect -exact “IMAP Password: “ send – “Password\r” expect -exact “\r localhost.localdomain> “
Create the mailbox user.$username.
send – “sq user/$username none” expect -exact “sq user/$username none localhost.localdomain> “
send – “quit\r” expect eof
######################################################
This script works with unixhierarchysep: yes and namespace “/” Now when you execute “./scriptname root” it would remove quota for user root. When you have a list of users you could do a:
#!/bin/bash
userlist=cat userlist.txt
for i in $userlist
do
/path/to/script $i
done