EXPECT script for Telnet automation. Need your support.

Dear experts, please help me .

I've found simple EXPECT scripts and all works fine. But I need more automation in error handling and sending list of commands/output logging from multiple remote hosts.

I have 10 hosts, for example:
host1 192.168.1.1 LOGIN1 PASSWORD1
...... ................ ........ ................
host10 192.168.5.16 LOGIN10 PASSWORD10

For me better to put these addresses and credentials to special "my_hosts" file in ~/scripts/teln/config/ directory.

Also I have a few files () with only sets of commands for remote hosts, for example:

enable
sh runn
con ter
br
en

I need expect script with 2 parameters: "Hosts list" file name and "Commands list for remote hosts" file name which can run this list of commands in all hosts (sequent, host by host) and put only telnet log to separate log files - one per host and/or one per command type.

Also I need every command from "Commands list for remote hosts" to be executed in cycle - to evaluate/expect for error printout and finish/halt script with line number of wrong command in "Commands list for remote hosts".

If "Stop on error", "Delay between commands" options will be available as CL parameters and in some .config file - it will be great.

I understand that this script is not possible with my dummy level but hope to get some useful information, support from you.

Thanks you in advance!

BR,
Alexander

---------- Post updated at 05:59 PM ---------- Previous update was at 03:17 PM ----------

Dear experts,

solution is found.

Please search: Automated_Remote_VTY_Command_Script

The expect telnet is so funky by itself for one host, it would be better to use either a wrapper shell script or a script generator shell script to apply it to a list of hosts/ports/command_sequences.

hi startchen,

can you share the script with me u alread have. i may can twork on and ammend it as i am looking to do the same thing but struggling.

Cheers