0

Is there any script or service that hits a specified website every X minutes?

3
  • @donald - Like apache benchmark? What is your underlying intention?
    – ajreal
    Nov 29, 2010 at 21:05
  • 1
    it looks like how do i do SEO to me....just a thought. if that's the case, it's a fail. Nov 29, 2010 at 21:18
  • Windows or Unix? Nov 29, 2010 at 23:35

6 Answers 6

7

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).

3
  • This will work, but probably end up with a pile of downloaded HTML in the directory you fire it off in :)
    – Chris Burgess
    Nov 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 Burgess
    Nov 29, 2010 at 21:06
1
import time
import urllib

while True:
    time.sleep(60)
    place = urllib.urlopen('http://www.google.com')
    print place.code
    place.read()
0

Have you looked at curl or wget and using that in a shell script or other kind of script?

0

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:

  1. download the file
  2. 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)
  3. if the files are the same, sleep and go back to 1
  4. 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.
0

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.

0

Use wget with a cron job. at least under linux. This is how i run my backup scripts and db-syncs on my websites