Re: running cyradm commands from a script

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Glennie Vignarajah wrote:
> Le Monday 15 October 2007, Jessi Berkelhammer(Jessi Berkelhammer 
> <jberkelhammer@xxxxxxxx>) a écrit:
> 
> 
> Hello,
> 
>> Ideally, I could use shell scripts to create a file with the
>> cyradm commands, and run those. Is there a way to do this so it
>> doesn't require the password to be entered interactively?
> 
> 
> Try something like this
> cyradm -u MY_LOGIN -w MY_PASSWORD MY_HOST << CYRADMSCRIPT
> lm
> lam user.*
> CYRADMSCRIPT
> Hope this helps!


the easiest way to do this is to use the EXPECT language...

script for adding users from command-line:

---
#!/usr/local/bin/expect -f
#
# usage: cyrus-adduser.exp john.doe
#
set user [lindex $argv 0]
#
#
spawn /usr/local/bin/cyradm -u cyrus localhost
expect "assword:"
send "your_password\r"
expect "host>"
#
send "cm user/$user \r"
expect "host>"
#
send "sq user/$user 153600\r"
expect "host>"
#
send "exit\r"
expect eof
#
------------


regards,
-- 
MSc. Marcelo Maraboli Rosselott
Jefe Area de Redes y Comunicaciones  (Network & UNIX Systems Engineer)
Ingeniero Civil Electronico, CISSP  (MSc., Electronic Engineer, CISSP)

Direccion Central de Servicios Computacionales (DCSC)
Universidad Tecnica Federico Santa Maria         phone: +56 32 2654071
Chile.    http://www.usm.cl                 http://elqui.dcsc.utfsm.cl
----
Cyrus Home Page: http://cyrusimap.web.cmu.edu/
Cyrus Wiki/FAQ: http://cyrusimap.web.cmu.edu/twiki
List Archives/Info: http://asg.web.cmu.edu/cyrus/mailing-list.html


[Index of Archives]     [Cyrus SASL]     [Squirrel Mail]     [Asterisk PBX]     [Video For Linux]     [Photo]     [Yosemite News]     [gtk]     [KDE]     [Gimp on Windows]     [Steve's Art]

  Powered by Linux