Skip to main content
vinodhk
Staff
Staff
September 18, 2022

Technical Tip: How to repeat a set of commands for specific number of times continuously

  • September 18, 2022
  • 0 replies
  • 1219 views
Description This Article describes the command on the FortiAP CLI to repeat a set of commands for specific number of times continuously.
Scope FortiAP.
Solution

- Login to the FortiAP CLI using SSH directly or from the FortiGate CLI.

- Execute the below commands on the FortiAP CLI to make the admin timeout to '0' hence the Forti AP CLI session will no be timed out.

 
cfg -a ADMIN_TIMEOUT=0
cfg -c
 
- Execute the below command on the FortiAP CLI to repeat the set of commands continuously for specific times.
 
cw_diag repeat 100 2 <"command1;command2;command3;command4">
 
Example:
 
cw_diag repeat 100 2 "cw_diag sys-performance;date;brctl;show arp -an;ifconfig eth0;ifconfig br0;ping -c 1 -s 1000 10.13.10.1; top -n 2"
 
100 <----- How many times the set of commands needs to be executed.
2 <-----In how many seconds interval the set of commands needs to be executed.