0

our new town doctor put a web camera to his waiting room for people to see how much crowded it is. As my mom and grandparents go to this doctor, I wanted to download the files periodically and if they are captured there, I wanted to send the photo to them. Childish, I know, but I just have to feed my procrastination during exam period. :) Now, to my problem.

On the web page of the doctor, there is the picture from the web camera. The picture is updated every 60 seconds. If I use right-click on it and selecting "Show picture on new tab" there is the picture with a clean link, no dynamic stuff, just like http://page.com/image.jpg. Also the same link is inside the page source code.

I have Ubuntu 14.04 32bit home server. I made a script (see lower) and added it to cron to run every minute ... it works fine, pictures are being created.

!/bin/bash

datum=$(date +"%Y%m%d-%H%M%S")

wget http://page.com/image.jpg -O /srv/2000raid/Test/image-$datum.jpg

But the problem is that the downloaded file is the same for about 10-11 following pictures. And then next 10-11 pictures are different then the previous batch, but all look alike. Etc ...

BUT - the picture on the web is changing.

So I guess there could be some problem with cache on the server, I tried wget --no-cache and wget --cache=off ... but nothing helped ...

Any ideas, please? :)

PS: Im not writing here the real link because Im afraid she wouldnt be very happy if there was some prankster trying to mess with her server by downloading the file every second or something like that ...

0

Off the top of my head, I'm not sure why this would be happening. I would suggest trying instead of every minute every 5 minutes or so.

I would check if you get the same results using cURL The cURL equivalent of your wget would look like curl -s -o /srv/2000raid/Test/image-$datum.jpg http://page.com/image.jpg

| improve this answer | |
  • Unfortunately, no change in behaviour. Also, I tried setting cron to 2,3,5 minutes but no change either. Setting 10 minutes is a) too long interval and b) I can have cron run the script every minute and then delete the other files from "the bundle" ... – user329804 Jun 5 '14 at 22:28
  • PS: To add to my first post - there is a pattern. When running the script every minute then every batch has 11 files. I dont know if its relevant, but I wanted to mention it. – user329804 Jun 6 '14 at 0:20
  • It sounds like the requests are missing something. Try watching the requests go through when you use a browser and then try to mock them up in case something is missing. – drglove Jun 6 '14 at 2:44
  • So, looks like I screwed up with checking the file on the webpage in the first place, it looked like the same file but it wasnt. The update times on web page differ, so I let my script to download the file every minute and then I used the following command to delete it if it was similar to others: ... "fdupes -r -f $cesta/ | grep -v '^$' | xargs rm -v" ... IM VERY SORRY I messed up and thanks for your answers! :) – user329804 Jun 10 '14 at 9:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.