What is SSH commands for this: run 20 times, break 2 seconds, and repeated again

Discussion in 'Site & Server Administration' started by basketmen, Dec 20, 2015.

  1. #1
    basketmen, Dec 20, 2015 IP
  2. samirj09

    samirj09 Well-Known Member

    Messages:
    335
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    125
    #2

    This should work:
    while true; do x=20 ; while [[ $x -ge "1" ]] ; do wget http://www.domain.com ; x=$(($x-1)) ; done ; sleep 2 ; done
    Code (markup):
    Although, on a side note, unless your intent is to have tons of files downloaded to the directory you run this in, I would recommend modifying your wget command to include a "-O /dev/null". Below is the modified loop.

    while true; do x=20 ; while [[ $x -ge "1" ]] ; do wget -O /dev/null http://www.domain.com ; x=$(($x-1)) ; done ; sleep 2 ; done
    Code (markup):
     
    Last edited: Dec 21, 2015
    samirj09, Dec 21, 2015 IP