I have a working script that telnets to multiple sites and runs commands while dumping the results to a file.
I have about 12 sites it connects to and I know a cleaner way to do this and be scalable for new sites is to just have it loop the telnet entries in my Connection Directory. Currently I'm manually pasting the the same dial command sequence multiple times and changing the SiteName.
It works now, but I just would like some tips on how I can condense it to just dial every entry in the Telnet Connection Directory, or to allow me to set a bunch of SiteName1, SiteName2 strings to be inserted in a loop until all are dialed and run.
proc main
set terminal scroll on
set capture recordmode SCREEN
set capture path "c:\router_data"
set capture file "resetflap_all.txt"
set capture overwrite ON ; off will append
capture on
yield
set aspect spawn ON ;allows script to spawn scripts
set dialentry scriptstart CONNECTED
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; dials entry from Connection Directory
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
dial TELNET "SiteName1"
while $DIALING
yield
endwhile
waitfor "#"
transmit "show calendar^M"
waitfor "#"
transmit "clear cable flap all^M"
waitfor "#"
transmit "exit^M"
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
dial TELNET "SiteName2"
while $DIALING
yield
endwhile
waitfor "#"
transmit "clear cable flap all^M"
waitfor "#"
transmit "exit^M"
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
capture off ; Close the capture file.
endproc
I have about 12 sites it connects to and I know a cleaner way to do this and be scalable for new sites is to just have it loop the telnet entries in my Connection Directory. Currently I'm manually pasting the the same dial command sequence multiple times and changing the SiteName.
It works now, but I just would like some tips on how I can condense it to just dial every entry in the Telnet Connection Directory, or to allow me to set a bunch of SiteName1, SiteName2 strings to be inserted in a loop until all are dialed and run.
proc main
set terminal scroll on
set capture recordmode SCREEN
set capture path "c:\router_data"
set capture file "resetflap_all.txt"
set capture overwrite ON ; off will append
capture on
yield
set aspect spawn ON ;allows script to spawn scripts
set dialentry scriptstart CONNECTED
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; dials entry from Connection Directory
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
dial TELNET "SiteName1"
while $DIALING
yield
endwhile
waitfor "#"
transmit "show calendar^M"
waitfor "#"
transmit "clear cable flap all^M"
waitfor "#"
transmit "exit^M"
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
dial TELNET "SiteName2"
while $DIALING
yield
endwhile
waitfor "#"
transmit "clear cable flap all^M"
waitfor "#"
transmit "exit^M"
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
capture off ; Close the capture file.
endproc