Minicom and scripting

Adam Lackorzynski adam at os.inf.tu-dresden.de
Mon Oct 3 22:28:31 UTC 2011


On Thu Sep 29, 2011 at 22:47:48 +0300, Martin T wrote:
> Adam,
> I played a little with runscript, but couldn't achive what I wanted.
> On the other hand, I'm a total beginner with runscript as well..
> However, what are the other options to make a script, which reads
> commands from a file one line after another, logs into a network
> device over a console connection(RS-232) each time and executes those
> commands wile sleeping 1s after each line? Is C-Kermit up to this
> task?

On Fri Sep 30, 2011 at 00:37:06 +0300, Martin T wrote:
> Adam,
> closest to the script I'm looking for was this(waits 2s after each
> command sent):
> 
> <<<<<
> root at IBM:~# cat script
> print "Starting Cisco 3550 configuration: "
> send ""
> expect {
> "WS-C3550-24-Rix>"
> }
> send "enable"
> expect {
> "WS-C3550-24-Rix#"
> }
> sleep 2
> send "conf t"
> expect {
> "WS-C3550-24-Rix(config)#"
> }
> sleep 2
> send "enable secret 0 passwd"
> expect {
> "WS-C3550-24-Rix(config)#"
> }
> sleep 2
> send "end"
> expect {
> "WS-C3550-24-Rix#"
> }
> sleep 2
> send "exit"
> 
> timeout 10
> exit
> root at IBM:~#
> >>>>>
> 
> However, it has one problem- I wasn't able to exit from runscript. As
> one can see, there is an "exit" command at the end of the script +
> "timeout 10", but I still had to hit "Ctrl+C" each time. What did I do
> wrong?
> 
> However, as you told, there seems to be no way to read commands in
> from a configuration file line by line using the runscript..

Maybe a scripting language of your choice will do that better.
Anyway, I wonder why you're configuring a switch like this. Why not use
something over network?


Adam
-- 
Adam                 adam at os.inf.tu-dresden.de
  Lackorzynski         http://os.inf.tu-dresden.de/~adam/



More information about the minicom-devel mailing list