Is there any script or service that hits a specified website every X minutes?
6 Answers
To hit it every two minutes:
while true; do curl yourwebsite.com >/dev/null; sleep 120; done
If you want this to run all day and night, use some kind of job-scheduling service like cron (but no while loop, of course).
-
This will work, but probably end up with a pile of downloaded HTML in the directory you fire it off in :)– Chris BurgessNov 29, 2010 at 21:05
-
@Chris: Yeah, I know. I must have changed it to curl while you were writing your comment. :-) Nov 29, 2010 at 21:06
-
wget -o /dev/null example.com ... oh you fixed it already, right :D– Chris BurgessNov 29, 2010 at 21:06
import time
import urllib
while True:
time.sleep(60)
place = urllib.urlopen('http://www.google.com')
print place.code
place.read()
It sounds to me like curl isn't going to do it. After all, why would you repeatedly grab data unless it's changing?
I wrote a satellite photo grabber in Java because I wanted to get a satellite photo every 15 minutes.
The pseudocode looks like this:
- download the file
- compare to the last file (this can be done by comparing the length, since almost always if the length is the same, the file hasn't changed. You still have to compare the bytes, but only when the file length has not changed)
- if the files are the same, sleep and go back to 1
- if they are different write out the new one under a new sequence number (sat1.jpg, sat2.jpg, etc. store the new one as the old image for next time sleep, then go back to 1.
Though that part of your question is off-topic, for the sake of completeness: onlinecronservices.com lists some web services that can do remote calls for you. The free services are not too reliable I guess, or only allow for one invocation per day.
Use wget with a cron job. at least under linux. This is how i run my backup scripts and db-syncs on my websites