how would I make this pause for 10mins then start back up and continuously loop...
#!/bin/sh
for page in {1..50}
do
wget -q -U Mozilla "http://www.domain.com/cat_search/item.html?p=$page" -O - \
| tr '"' '\n' | grep "^Item photo for " | cut -d ' ' -f 4 >> bpitem.txt
sleep 15
done
/bin/sleep is Linux or Unix command to delay for a specified amount of time. You can suspend the calling shell script for a specified time. For example, pause for 10 seconds or stop execution for 2 mintues. In other words, the sleep command pauses the execution on the next shell command for a given time.
How to Use the Bash Sleep Command. Sleep is a very versatile command with a very simple syntax. It is as easy as typing sleep N . This will pause your script for N seconds, with N being either a positive integer or a floating point number.
Within the script you can add the following in between the actions you would like the pause. This will pause the routine for 5 seconds. read -p "Pause Time 5 seconds" -t 5 read -p "Continuing in 5 Seconds...." -t 5 echo "Continuing ...."
The following syntax is used for create infinite while loop in a shell script. echo "Press [CTRL+C] to exit this loop..." You can also Unix true command with while loop to run it endlessly.
Enclose the code in a while like this:
while :
do
your_code
sleep 600
done
Put it in an infinite loop like this:
while :
do
for page in {1..50}
do
wget -q -U Mozilla "http://www.domain.com/cat_search/item.html?p=$page" -O - \
| tr '"' '\n' | grep "^Item photo for " | cut -d ' ' -f 4 >> bpitem.txt
sleep 15
done
sleep 10m
done
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With