cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
416
Views
0
Helpful
3
Replies
Beginner

Prime CLI template pause between commands

Is there a way to add a pause between commands in a Prime 3.1 CLI template?

 

The goal is to make a template to disable a port and leave it disabled for a time before proceeding to re-enable the port.

 

Below is what I have so far. From what I understand, <timeout> is used in the "Reboot" system template to wait a specified amount of time to allow the switch to reboot before determining whether the deployment was successful (if the switch came back up) or not. However, by running this template as it is, it simply enters whatever number is specified for the Wait_time variable, which produces the error: "Error occured while executing the command 2.Command Output : 22^% Invalid input detected at '^' marker."

 

#if ( $Is_range eq "No" )
#MODE_ENABLE                
conf t
int ${Interface}
power inline never
shut
<timeout>${Wait_time}</timeout>
no shut
power inline auto
end
#MODE_END_ENABLE
#else
#MODE_ENABLE
conf t
int range ${Interface}
power inline never
shut
<timeout>${Wait_time}</timeout>
no shut
power inline auto
end
#MODE_END_ENABLE
#end

 

1 ACCEPTED SOLUTION

Accepted Solutions
Beginner

Re: Prime CLI template pause between commands

After learning about "terminal shell" and "sleep," I was able to accomplish the goal. Here's the CLI content for anyone who's interested. "sleep 30" is what delays by 30 seconds (or however many seconds you choose).

#MODE_ENABLE                
terminal shell
conf t
#if ( $Is_range eq "No" )
   int $Interface
#else
   int range $Interface
#end
shut
end
sleep 30
conf t
#if ( $Is_range eq "No" )
int $Interface
#else
int range $Interface
#end
no shut
end
terminal no shell
#MODE_END_ENABLE

 

3 REPLIES 3
Beginner

Re: Prime CLI template pause between commands

Hi, any suggestions would be appreciated.
Beginner

Re: Prime CLI template pause between commands

After learning about "terminal shell" and "sleep," I was able to accomplish the goal. Here's the CLI content for anyone who's interested. "sleep 30" is what delays by 30 seconds (or however many seconds you choose).

#MODE_ENABLE                
terminal shell
conf t
#if ( $Is_range eq "No" )
   int $Interface
#else
   int range $Interface
#end
shut
end
sleep 30
conf t
#if ( $Is_range eq "No" )
int $Interface
#else
int range $Interface
#end
no shut
end
terminal no shell
#MODE_END_ENABLE

 

Highlighted
Beginner

Re: Prime CLI template pause between commands

When you issue the "term shell" command you can verify it is in effect with the "show term" command.

I have found that if you issue the "term shell" command, then enter config mode (conf t), when you exit config mode, the show term shows that the term shell is no longer in effect.

 

I issue the "term shell" command just before I use the "sleep x" command.

 

I have found the availability of the sleep command is not as great as have TCLsh available as in:

 

tclsh
after 10000
exit

 

which will sleep for 10 seconds.

CreatePlease to create content
Content for Community-Ad
July's Community Spotlight Awards