红联Linux门户
Linux帮助

ubuntu 下请教一个关于 expect 的脚本

发布时间:2010-09-14 11:30:54来源:红联作者:zzm35837995
我改了 /etc/asterisk/sip.conf 的内容 ,现在想使它生效 ,可以输入命令 sudo asterisk -r 进入

heizi-desktop*CLI> 输入 sip reload 然后 heizi-desktop*CLI> 输入exit , OK
现在我写了个脚本,希望可以 执行交互的功能,脚本如下:
#! /usr/bin/expect -f

spawn sudo asterisk -r
expect "heizi-desktop*CLI> "
send "sip reload\r"
expect "heizi-desktop*CLI> "
send "exit\r"
expect eof

打印信息如下 : heizi@heizi-desktop:~/zhouzeming$ ./asterisk
spawn sudo asterisk -r
Asterisk 1.6.2.5-0ubuntu1, Copyright (C) 1999 - 2009 Digium, Inc. and others.
Created by Mark Spencer <markster@digium.com>
Asterisk comes with ABSOLUTELY NO WARRANTY; type 'core show warranty' for details.
This is free software, with components licensed under the GNU General Public
License version 2 and other licenses; you are welcome to redistribute it under
certain conditions. Type 'core show license' for details.
=========================================================================
Connected to Asterisk 1.6.2.5-0ubuntu1 currently running on heizi-desktop (pid = 1405)
heizi-desktop*CLI> sip reload
heizi-desktop*CLI> exit
heizi@heizi-desktop:~/zhouzeming$


但是sip reload 没有实现啊? 这是为什么呢?
文章评论

共有 0 条评论