cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
8736
Views
0
Helpful
6
Replies

Cisco IOS Script pause execute

ty.masse
Level 1
Level 1

  I'm writting a script for my router to performe a series of functions.  Basically cutting and pasting from notepad with a series of commands to execute.  Does any one know how to make IOS pause for a set number of seconds before continuing.   For example:

One of those commands is power inline never on a switch.  I'd like the device to wait 15 seconds before moving to the next step which is power inline never.  To give all the phones a chance to power down before they come back up.  A better example is below.

I've tried every thing, but can't find how to do that.

power inline never

(wait 15 secs)

power inline auto               

thanks,

6 Replies 6

Dan Frey
Cisco Employee
Cisco Employee

Your using tclsh to paste in the config and want it to pause for 15 seconds?    If so, you can use the after command.  The after command takes the value in ms.

SPOKE_1(tcl)#show clock

*16:21:30.543 EDT Mon Mar 25 2013

SPOKE_1(tcl)#after 15000

SPOKE_1(tcl)#show clock

*16:21:45.562 EDT Mon Mar 25 2013

Dan

Thanks for the reply.  I was doing it from notepad and pasting the commands as if I was typing them in.  I've used tcl scripts before to configure an IVR in CME; but i'm not familiar with tclsh.  It seems to be a better way.  Can you send me some more information on that tool, or where can I find some more info on it?

thanks.

tclsh (TCL shell)  allows you to run TCL commands interactively.   Also allows users to execute CLI commands into tclsh.   Take a look at the link below.

http://www.cisco.com/en/US/partner/docs/ios-xml/ios/ios_tcl/configuration/15-s/nm-script-tcl.html#GUID-59A0BD8D-6791-4015-95E8-C26A55397BEF

Dan

the link says:

Forbidden File or Application

the Q
Level 1
Level 1

I know it's an old thread but it's still my question also.  I'm looking for that same thing right now.  I want to paste into a router the following. 

ping 1.2.3.4

<delay, pause, sleep, whatever for 10 seconds>

ping 1.2.3.5

<delay, pause, sleep, whatever for 10 seconds>

ping 1.2.3.6

<delay, pause, sleep, whatever for 10 seconds>

If I simply paste a list of pings into the console, the router does approximately every third or fourth one, so if I could insert a 10 second pause it would most likely work.

I assume tclsh is an install or something?  The link is dead.  What's involved in tclsh.  I just need this this one time.  I don't want to install something. 

Maybe I'm barking up the wrong tree.  Maybe the problem is the terminal doesn't wait for output to finish before interpreting the next command ..... It seems to be inhaling the paste and applying a ping or two while the first ping is still processing, so it ignores them. 

Maybe I need a new terminal protocol????  or turn on a feature of vty??? 

I'm in SecureCRT, SSH2, vt100. 

thanks

nothing to install.   Execute this CLI putting in your IP addresses and it will wait 10 seconds between pinging each IP.

Router#tclsh

Router(tcl)#foreach IP {192.168.0.1 192.168.0.2 192.168.0.3} {

ping $IP

after 10000

}

Link works fine for me.

Review Cisco Networking products for a $25 gift card